Remove PostRefreshUpdateKeepingScrollPosition

Now that we have PostRefreshUpdateWithOptions there's no reason to offer
a bespoke method for setting one particular option.
This commit is contained in:
Stefan Haller 2026-08-29 12:56:04 +02:00 committed by GitHub
parent fa531dc518
commit d37f901ac1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 4 additions and 10 deletions

View file

@ -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})
})
}

View file

@ -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)

View file

@ -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)
}

View file

@ -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)