From 3375637d93bacafe0c530abc316819459495b3cc Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 23 Jun 2026 16:05:20 +0200 Subject: [PATCH] Drop the bespoke commit-discard selection reveal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Discarding lines from a commit via the focused main view installed its own revealSelectionAfterPrimaryAction before the rebase. That rebase rewrites the commit, so the selection-preserve net now re-establishes the selection as the diff re-renders — with the same anchor (the selection's first line), making this install redundant. Files-discard keeps its own reveal: its diff command is stable, so the net never fires there, and it has staging's focus-follow to the secondary pane besides. Co-Authored-By: Claude Opus 4.8 (1M context) --- pkg/gui/controllers/patch_building_from_main_view.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pkg/gui/controllers/patch_building_from_main_view.go b/pkg/gui/controllers/patch_building_from_main_view.go index d66dbdb5a..4fba9054f 100644 --- a/pkg/gui/controllers/patch_building_from_main_view.go +++ b/pkg/gui/controllers/patch_building_from_main_view.go @@ -213,12 +213,9 @@ func discardSelectionFromCommit( }, func(gocui.Task) error { c.LogAction(c.Tr.Actions.RemovePatchFromCommit) err := c.Git().Patch.DeletePatchesFromCommit(c.Model().Commits, commitIndex) - // The rebase removes the selected lines, so the commit's diff shrinks - // there. Re-establish the selection at its change-line ordinal once the - // refresh below re-renders the diff, advancing to the next surviving change - // just like staging — installed before the refresh so the re-render rides - // it. The diff stays in the same pane, so source and target are the same. - revealSelectionAfterPrimaryAction(c, mainViewName, mainViewName, firstLineIdx) + // The rebase rewrites the commit, so the focused main view's selection is + // re-established on the next surviving change as the diff re-renders (see + // preserveFocusedMainViewSelectionAcrossContentChange). return c.Helpers().MergeAndRebase.CheckMergeOrRebase(err) }) },