Refresh main view when cycling pagers with main view focused

The previous logic only re-rendered the main view when the side panel itself was
focused. When the user pressed `0` to focus the main view, the
Normal/NormalSecondary context becomes Current and the equality check failed, so
cycling pagers had no visible effect. Mirror the pattern from postRefreshUpdate:
when the main view is focused, call HandleRenderToMain on the side panel below
it on the stack (which CurrentSide already returns).
This commit is contained in:
Stefan Haller 2026-05-26 07:57:32 +02:00
parent 137831630a
commit e6a8415162

View file

@ -3,6 +3,7 @@ package controllers
import (
"fmt"
"github.com/jesseduffield/lazygit/pkg/gui/context"
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
@ -157,8 +158,12 @@ func (self *GlobalController) prevScreenMode() error {
func (self *GlobalController) cyclePagers() error {
self.c.State().GetPagerConfig().CyclePagers()
if self.c.Context().CurrentSide().GetKey() == self.c.Context().Current().GetKey() {
self.c.Context().CurrentSide().HandleRenderToMain()
currentSide := self.c.Context().CurrentSide()
currentKey := self.c.Context().Current().GetKey()
if currentSide.GetKey() == currentKey ||
currentKey == context.NORMAL_MAIN_CONTEXT_KEY ||
currentKey == context.NORMAL_SECONDARY_CONTEXT_KEY {
currentSide.HandleRenderToMain()
}
current, total := self.c.State().GetPagerConfig().CurrentPagerIndex()