From d1707d5dd27dfab0e291eefb13905bea95fb086c Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 21 Aug 2026 13:21:10 +0200 Subject: [PATCH] Re-render the main view without re-focusing the panel beneath it Toggling whitespace needs the panel beneath to render its diff again, which is what HandleRenderToMain is for; HandleFocus does that and also everything else that belongs to a panel gaining the focus, which this panel already has or, when the focus is in the main view, does not want. Re-selecting its current item is harmless, but re-deriving its highlight as a focused panel's is not: the selection turns bright while the user is somewhere else. Changing the context size and switching diff renderers already ask for a re-render this way. Co-authored-by: Claude Opus 5 (1M context) --- pkg/gui/controllers/toggle_whitespace_action.go | 2 +- .../ui/toggle_whitespace_keeps_unfocused_selection_dimmed.go | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/gui/controllers/toggle_whitespace_action.go b/pkg/gui/controllers/toggle_whitespace_action.go index a1ac0c8da..67bb59d86 100644 --- a/pkg/gui/controllers/toggle_whitespace_action.go +++ b/pkg/gui/controllers/toggle_whitespace_action.go @@ -27,6 +27,6 @@ func (self *ToggleWhitespaceAction) Call() error { self.c.UserConfig().Git.IgnoreWhitespaceInDiffView = !self.c.UserConfig().Git.IgnoreWhitespaceInDiffView - self.c.Context().CurrentSide().HandleFocus(types.OnFocusOpts{}) + self.c.Context().CurrentSide().HandleRenderToMain() return nil } diff --git a/pkg/integration/tests/ui/toggle_whitespace_keeps_unfocused_selection_dimmed.go b/pkg/integration/tests/ui/toggle_whitespace_keeps_unfocused_selection_dimmed.go index 30223c3b8..9ffbd2878 100644 --- a/pkg/integration/tests/ui/toggle_whitespace_keeps_unfocused_selection_dimmed.go +++ b/pkg/integration/tests/ui/toggle_whitespace_keeps_unfocused_selection_dimmed.go @@ -26,9 +26,6 @@ var ToggleWhitespaceKeepsUnfocusedSelectionDimmed = NewIntegrationTest(NewIntegr Press(keys.Universal.ToggleWhitespaceInDiffView) t.Views().Files(). - /* EXPECTED: SelectionIsInactive() - ACTUAL: */ - SelectionIsActive() }, })