From e03f4b1321065bdb9313798403528aa5988897ec Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 20 Jun 2026 17:13:45 +0200 Subject: [PATCH] Carry hunk mode into the other pane on a cross-pane click Clicking the staged/unstaged pane you weren't focused on selected a single line the first time, even in hunk mode, because that pane's select mode was still its default until it had been focused once (tabbing to it and back was the workaround). Seed the clicked pane's mode from the one we're leaving so the very first click there behaves like every later one. Co-Authored-By: Claude Opus 4.8 (1M context) --- pkg/gui/controllers/main_view_controller.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/gui/controllers/main_view_controller.go b/pkg/gui/controllers/main_view_controller.go index 0b580b985..99e2f97e4 100644 --- a/pkg/gui/controllers/main_view_controller.go +++ b/pkg/gui/controllers/main_view_controller.go @@ -977,6 +977,12 @@ func (self *MainViewController) editClickedLine(opts gocui.ViewMouseBindingOpts) } func (self *MainViewController) onClickInOtherViewOfMainViewPair(opts gocui.ViewMouseBindingOpts) error { + // Carry the select mode over from the pane we're leaving, so clicking into the + // other pane keeps hunk mode even the first time we enter it — without this its + // mode would still be the default single line until it had been focused at least + // once (e.g. by tabbing to it). selectClickedDiffLine then preserves or collapses + // that mode depending on where we clicked. + *self.context.DiffSelectState() = *self.otherContext.DiffSelectState() self.c.Context().Push(self.context, types.OnFocusOpts{}) return self.selectClickedDiffLine(opts) }