Drop the bespoke commit-discard selection reveal

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) <noreply@anthropic.com>
This commit is contained in:
Stefan Haller 2026-06-23 16:05:20 +02:00
parent fdb16a1c7e
commit 3375637d93

View file

@ -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)
})
},