mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-08-24 10:13:41 -05:00
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:
co-authored by
Claude Opus 4.8
parent
6316094d58
commit
5a4247b234
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user