mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-08-24 10:13:41 -05:00
Reset other main views' scroll after copying content, not before
refreshMainViews reset the scroll position of every other main view at the very top, before moveMainContextPairToTop runs its CopyContent. CopyContent copies the previously-shown view's content into the now-visible one to avoid a blank frame during the async re-render — but because the reset ran first, it had already zeroed the origin of that soon-to-be-copied source view. The placeholder therefore always appeared scrolled to the top, jumping away from wherever the screen actually was, on every cross-pair transition. Move the reset to after the copy. The end state is unchanged (each other main view still ends at origin 0, and the destination always re-renders), but the brief placeholder now stays at the source view's real scroll position until the real content paints. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
fbadbbf99a
commit
114d18dc04
+14
-10
@@ -107,16 +107,6 @@ func (gui *Gui) allMainContextPairs() []types.MainContextPair {
|
||||
}
|
||||
|
||||
func (gui *Gui) refreshMainViews(opts types.RefreshMainOpts) {
|
||||
// need to reset scroll positions of all other main views
|
||||
for _, pair := range gui.allMainContextPairs() {
|
||||
if pair.Main != opts.Pair.Main {
|
||||
pair.Main.GetView().SetOrigin(0, 0)
|
||||
}
|
||||
if pair.Secondary != nil && pair.Secondary != opts.Pair.Secondary {
|
||||
pair.Secondary.GetView().SetOrigin(0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
gui.moveMainContextPairToTop(opts.Pair)
|
||||
|
||||
if opts.Main != nil {
|
||||
@@ -129,6 +119,20 @@ func (gui *Gui) refreshMainViews(opts types.RefreshMainOpts) {
|
||||
opts.Pair.Secondary.GetView().Clear()
|
||||
}
|
||||
|
||||
// Reset the scroll positions of all the other main views. We do this after
|
||||
// moving this pair to the top (which copies the previously-shown view's
|
||||
// content into the now-visible one to avoid a blank frame): resetting first
|
||||
// would zero that source view's scroll before it gets copied, forcing the
|
||||
// placeholder to the top instead of leaving it where the screen already was.
|
||||
for _, pair := range gui.allMainContextPairs() {
|
||||
if pair.Main != opts.Pair.Main {
|
||||
pair.Main.GetView().SetOrigin(0, 0)
|
||||
}
|
||||
if pair.Secondary != nil && pair.Secondary != opts.Pair.Secondary {
|
||||
pair.Secondary.GetView().SetOrigin(0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
gui.splitMainPanel(opts.Secondary != nil)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user