Fix annoying UI stalls after refresh (e.g. background fetch) when the reflog is very long#5135
Merged
Merged
Conversation
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesFootnotes
|
293846b to
c6aae9b
Compare
0956418 to
ce0a1ce
Compare
c6aae9b to
909e831
Compare
ce0a1ce to
30a2cc3
Compare
909e831 to
93eab94
Compare
30a2cc3 to
a01c9a9
Compare
93eab94 to
c2aef7d
Compare
a01c9a9 to
478d51c
Compare
Base automatically changed from
dont-scroll-selection-into-view-on-refresh
to
master
December 23, 2025 14:37
c2aef7d to
baa936b
Compare
Move SetContentLineCount into OverwriteLinesAndClearEverythingElse. Calling it separately beforehand is not concurrency safe; we need both to happen when the view's writeMutex is locked.
This fixes a bug in ListContextTrait.FocusLine whereby the view would go blank when scrolling by page (using ',' or '.') in views that have renderOnlyVisibleLines set to true but refreshViewportOnChange set to false. Currently we don't have any such views; the only ones who use renderOnlyVisibleLines are commits and subcommits, and they also use refreshViewportOnChange. However, we are going to add one in the next commit, and eventually it might be a good idea to convert all our list views to that by default, and get rid of the renderOnlyVisibleLines flag.
Since the reflog can get very long, this saves some memory but especially some UI thread lag. In one of my repos I had over 11'000 reflog entries (I guess I should prune them more regularly...), and rendering them took ~600ms; since this happens on the UI thread, there was an annoying stall for half a second after every background fetch, for example.
baa936b to
84be082
Compare
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
Jan 9, 2026
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [jesseduffield/lazygit](https://github.com/jesseduffield/lazygit) | minor | `v0.57.0` → `v0.58.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>jesseduffield/lazygit (jesseduffield/lazygit)</summary> ### [`v0.58.0`](https://github.com/jesseduffield/lazygit/releases/tag/v0.58.0) [Compare Source](jesseduffield/lazygit@v0.57.0...v0.58.0) <!-- Release notes generated using configuration in .github/release.yml at v0.58.0 --> #### What's Changed ##### Enhancements 🔥 - Add keys for command log menu items by [@​PeterCardenas](https://github.com/PeterCardenas) in [#​5096](jesseduffield/lazygit#5096) - Add Codeberg as a supported git hosting service by [@​yaadata](https://github.com/yaadata) in [#​5130](jesseduffield/lazygit#5130) - Change keybinding of "keep" item in Merge Conflict menu back to 'k' by [@​stefanhaller](https://github.com/stefanhaller) in [#​5132](jesseduffield/lazygit#5132) - Support custom keybindings in custom command menu prompts by [@​HerrNaN](https://github.com/HerrNaN) in [#​5129](jesseduffield/lazygit#5129) - Show an error when checking out a file would overwrite local modifications by [@​stefanhaller](https://github.com/stefanhaller) in [#​5154](jesseduffield/lazygit#5154) ##### Fixes 🔧 - Remove confirmation for opening the merge tool by [@​stefanhaller](https://github.com/stefanhaller) in [#​5094](jesseduffield/lazygit#5094) - Allow using 'j', 'k', 'H', or 'L' as keybindings in custom command menus by [@​stefanhaller](https://github.com/stefanhaller) in [#​5131](jesseduffield/lazygit#5131) - Prevent many hyperlinks from launching while mouse moving by [@​stefanhaller](https://github.com/stefanhaller) in [#​5133](jesseduffield/lazygit#5133) - Fix the main view display after reverting a commit by [@​stefanhaller](https://github.com/stefanhaller) in [#​5138](jesseduffield/lazygit#5138) - Avoid scrolling the selection into view on refresh by [@​stefanhaller](https://github.com/stefanhaller) in [#​5134](jesseduffield/lazygit#5134) - Fix rendering of certain emojis by [@​stefanhaller](https://github.com/stefanhaller) in [#​5116](jesseduffield/lazygit#5116) ##### Docs 📖 - Fix small issues with the Breaking Changes texts by [@​stefanhaller](https://github.com/stefanhaller) in [#​5114](jesseduffield/lazygit#5114) - Add a note about delta's `--navigate` option not working in lazygit by [@​stefanhaller](https://github.com/stefanhaller) in [#​5155](jesseduffield/lazygit#5155) - Update docs and schema for release by [@​stefanhaller](https://github.com/stefanhaller) in [#​5168](jesseduffield/lazygit#5168) ##### I18n 🌎 - Update translations from Crowdin by [@​stefanhaller](https://github.com/stefanhaller) in [#​5167](jesseduffield/lazygit#5167) ##### Performance Improvements 📊 - Fix annoying UI stalls after refresh (e.g. background fetch) when the reflog is very long by [@​stefanhaller](https://github.com/stefanhaller) in [#​5135](jesseduffield/lazygit#5135) #### New Contributors - [@​yaadata](https://github.com/yaadata) made their first contribution in [#​5130](jesseduffield/lazygit#5130) - [@​HerrNaN](https://github.com/HerrNaN) made their first contribution in [#​5129](jesseduffield/lazygit#5129) **Full Changelog**: <jesseduffield/lazygit@v0.57.0...v0.58.0> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi42OS4yIiwidXBkYXRlZEluVmVyIjoiNDIuNjkuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6Om1pbm9yIl19-->
stefanhaller
added a commit
that referenced
this pull request
Jan 29, 2026
This is a regression introduced with #5135. I didn't notice it because I am using `gui.scrollOffBehavior: jump`, in which case the problem wouldn't appear; it only happened with `scrollOffBehavior: margin` (which is the default). In that case, if you used the arrow keys (or j/k) to move the selection so that the view would start to scroll, empty space would appear.
stefanhaller
added a commit
that referenced
this pull request
Jan 29, 2026
) This is a regression introduced with #5135. I didn't notice it because I am using `gui.scrollOffBehavior: jump`, in which case the problem wouldn't appear; it only happened with `scrollOffBehavior: margin` (which is the default). In that case, if you used the arrow keys (or j/k) to move the selection so that the view would start to scroll, empty space would appear. Fixes #5235.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draw only the visible lines of the reflogs panel, like we do for commits.
Since the reflog can get very long, this saves some memory but especially some UI thread lag. In one of my repos I had over 11'000 reflog entries (I guess I should prune them more regularly...), and rendering them took ~600ms; since this happens on the UI thread, there was an annoying stall for half a second after every background fetch, for example (even if the reflog panel is not visible).