1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-25 12:24:47 +02:00

Change NewRenderStringWith{out}ScrollTask to reuse the task key of the existing task

This way it won't scroll to the top; we want this when entering the staging
panel or the patch building panel by clicking into the view, and also when
returning from these views by pressing escape. Note that there's a bug in this
latter case: the focused panel still scrolls to the top when hitting escape, we
will fix this in the next commit.

Change it in the same way for NewRenderStringWithScrollTask, just for
consistency, although it's not really necessary there. We use this function only
for focusing the merge conflict view, and in that case we already have an empty
task key before and after, so it doesn't change anything there.
This commit is contained in:
Stefan Haller 2024-10-16 18:01:04 +02:00
parent 4883c867bb
commit eaf3bf0971

View File

@ -53,9 +53,7 @@ func (gui *Gui) newStringTaskWithoutScroll(view *gocui.View, str string) error {
return nil
}
// Using empty key so that on subsequent calls we won't reset the view's origin.
// Note this means that we will be scrolling back to the top if we're switching from a different key
if err := manager.NewTask(f, ""); err != nil {
if err := manager.NewTask(f, manager.GetTaskKey()); err != nil {
return err
}
@ -71,7 +69,7 @@ func (gui *Gui) newStringTaskWithScroll(view *gocui.View, str string, originX in
return nil
}
if err := manager.NewTask(f, ""); err != nil {
if err := manager.NewTask(f, manager.GetTaskKey()); err != nil {
return err
}