diff --git a/pkg/gui/controllers/helpers/refresh_helper.go b/pkg/gui/controllers/helpers/refresh_helper.go index 7988c3697..5eb699da2 100644 --- a/pkg/gui/controllers/helpers/refresh_helper.go +++ b/pkg/gui/controllers/helpers/refresh_helper.go @@ -1851,7 +1851,8 @@ func (self *RefreshHelper) setGithubPullRequests(baseInfo *githubRemoteInfo, bra // This lands whenever the network call happens to return, and only // changes how the branches are rendered, not which one is selected, so // it has no business moving the viewport. - self.c.PostRefreshUpdateKeepingScrollPosition(self.c.Contexts().Branches) + self.c.PostRefreshUpdateWithOptions(self.c.Contexts().Branches, + types.OnFocusOpts{KeepScrollPosition: true}) }) } diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go index 43d62f0cc..b1f89baa9 100644 --- a/pkg/gui/controllers/local_commits_controller.go +++ b/pkg/gui/controllers/local_commits_controller.go @@ -191,7 +191,8 @@ func (self *LocalCommitsController) handleCommitDrag(opts gocui.ViewMouseBinding self.commitDrag.hasMoved = true if self.updateCommitDragInsertion(opts.Y) { - self.c.PostRefreshUpdateKeepingScrollPosition(self.context()) + self.c.PostRefreshUpdateWithOptions(self.context(), + types.OnFocusOpts{KeepScrollPosition: true}) } originY := self.context().GetView().OriginY() self.dragAutoscroller.Update(opts.Y - originY) diff --git a/pkg/gui/gui_common.go b/pkg/gui/gui_common.go index 86b0455ee..692df5142 100644 --- a/pkg/gui/gui_common.go +++ b/pkg/gui/gui_common.go @@ -46,10 +46,6 @@ func (self *guiCommon) PostRefreshUpdateWithOptions(context types.Context, opts self.gui.postRefreshUpdate(context, opts) } -func (self *guiCommon) PostRefreshUpdateKeepingScrollPosition(context types.Context) { - self.gui.postRefreshUpdate(context, types.OnFocusOpts{KeepScrollPosition: true}) -} - func (self *guiCommon) RunSubprocessAndRefresh(cmdObj *oscommands.CmdObj) error { return self.gui.runSubprocessWithSuspenseAndRefresh(cmdObj) } diff --git a/pkg/gui/types/common.go b/pkg/gui/types/common.go index 85fabeb13..92cc141cf 100644 --- a/pkg/gui/types/common.go +++ b/pkg/gui/types/common.go @@ -54,10 +54,6 @@ type IGuiCommon interface { // Like PostRefreshUpdate, with control over scrolling and whether to update // the main view. PostRefreshUpdateWithOptions(Context, OnFocusOpts) - // Like PostRefreshUpdate, but leaves the view scrolled where it is. For - // refreshes that no user action is behind: those must not move the viewport - // away from wherever the user last put it. - PostRefreshUpdateKeepingScrollPosition(Context) // renders string to a view without resetting its origin SetViewContent(view *gocui.View, content string)