Skip to content

Commit eaf3bf0

Browse files
committed
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.
1 parent 4883c86 commit eaf3bf0

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pkg/gui/tasks_adapter.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ func (gui *Gui) newStringTaskWithoutScroll(view *gocui.View, str string) error {
5353
return nil
5454
}
5555

56-
// Using empty key so that on subsequent calls we won't reset the view's origin.
57-
// Note this means that we will be scrolling back to the top if we're switching from a different key
58-
if err := manager.NewTask(f, ""); err != nil {
56+
if err := manager.NewTask(f, manager.GetTaskKey()); err != nil {
5957
return err
6058
}
6159

@@ -71,7 +69,7 @@ func (gui *Gui) newStringTaskWithScroll(view *gocui.View, str string, originX in
7169
return nil
7270
}
7371

74-
if err := manager.NewTask(f, ""); err != nil {
72+
if err := manager.NewTask(f, manager.GetTaskKey()); err != nil {
7573
return err
7674
}
7775

0 commit comments

Comments
 (0)