Skip to content

Commit

Permalink
Change NewRenderStringWith{out}ScrollTask to reuse the task key of th…
Browse files Browse the repository at this point in the history
…e 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.
  • Loading branch information
stefanhaller committed Oct 18, 2024
1 parent 4883c86 commit eaf3bf0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/gui/tasks_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
}

Expand Down

0 comments on commit eaf3bf0

Please sign in to comment.