Extract onPagerChanged helper from cyclePagers

A reverse-cycle handler is about to need the same re-render-and-toast
logic. Pull it out first so the behavior change that follows only has to
swap the cycle direction.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Haller
2026-06-07 15:51:57 +02:00
co-authored by Claude Opus 4.8
parent 6316094d58
commit 5a4247b234
+7 -1
View File
@@ -159,6 +159,13 @@ func (self *GlobalController) prevScreenMode() error {
func (self *GlobalController) cyclePagers() error {
self.c.State().GetPagerConfig().CyclePagers()
self.onPagerChanged()
return nil
}
// onPagerChanged re-renders the main view so the newly selected pager takes
// effect, and shows a toast naming it.
func (self *GlobalController) onPagerChanged() {
currentSide := self.c.Context().CurrentSide()
currentKey := self.c.Context().Current().GetKey()
if currentSide.GetKey() == currentKey ||
@@ -182,7 +189,6 @@ func (self *GlobalController) cyclePagers() error {
"current": strconv.Itoa(current + 1),
"total": strconv.Itoa(total),
}))
return nil
}
func (self *GlobalController) canCyclePagers() *types.DisabledReason {