diff --git a/pkg/gui/controllers/helpers/refresh_helper.go b/pkg/gui/controllers/helpers/refresh_helper.go index b919eb84b..e8477c35b 100644 --- a/pkg/gui/controllers/helpers/refresh_helper.go +++ b/pkg/gui/controllers/helpers/refresh_helper.go @@ -906,7 +906,14 @@ func (self *RefreshHelper) refreshCommitsWithLimit(captured capturedCommitState, // The caller set the selection index deliberately; leave it untouched. } - self.rerenderView(self.c.Contexts().LocalCommits, env.focusOpts()) + focusOpts := env.focusOpts() + if newConflictedCommitIdx != nil { + // We selected a commit that the user needs to look at next, so + // scroll it into view even if the refresh keeps the scroll position + // otherwise. + focusOpts.KeepScrollPosition = false + } + self.rerenderView(self.c.Contexts().LocalCommits, focusOpts) }) return nil diff --git a/pkg/integration/tests/ui/background_refresh_scrolls_to_conflicted_commit.go b/pkg/integration/tests/ui/background_refresh_scrolls_to_conflicted_commit.go index ea4c0b308..e0c1d1605 100644 --- a/pkg/integration/tests/ui/background_refresh_scrolls_to_conflicted_commit.go +++ b/pkg/integration/tests/ui/background_refresh_scrolls_to_conflicted_commit.go @@ -31,10 +31,7 @@ var BackgroundRefreshScrollsToConflictedCommit = NewIntegrationTest(NewIntegrati }). // The conflicted commit, below the 30 pending todos and their header SelectedLineIdx(31). - /* EXPECTED: SelectedLineIsVisible(). SelectedLine(Contains("<-- CONFLICT --- this will conflict")) - ACTUAL: */ - OriginY(0) }, })