mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 15:46:26 -04:00
The reveal that advances the focused main view's selection after staging captured the next/previous change block as a patch identity and found it again in the re-rendered diff via SamePatchLine. SamePatchLine keys a deletion on its old-file (index-side) line number, which staging shifts: staging a hunk that changes the line count moves the index-side numbers of every hunk below it. So a deletion-led "next hunk" candidate no longer matched, and the reveal fell back to a worse candidate — often colliding with a header or context row (SamePatchLine doesn't require a change line) and, in hunk mode, snapping to the first change block. The visible result was the selection jumping to an *earlier* hunk after staging. Match the reveal's candidates by their worktree (new-file) line number, which staging never moves, and require a change line of the same side. This is safe here because the reveal only ever targets change blocks and selectHunkAround expands to the whole block, so the new-file number's ambiguity between two consecutive deletions (the reason SamePatchLine uses the old-file number) doesn't matter. The escape restore and the -U context-size preserve keep SamePatchLine: they re-render the same staged/unstaged state, so no index-side shift, and the latter deliberately anchors on context lines. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| app | ||
| cheatsheet | ||
| commands | ||
| common | ||
| config | ||
| constants | ||
| env | ||
| fakes | ||
| gocui | ||
| gui | ||
| i18n | ||
| integration | ||
| jsonschema | ||
| logs | ||
| snake | ||
| tasks | ||
| theme | ||
| updates | ||
| utils | ||