mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 15:46:26 -04:00
The reveal advanced the selection by capturing the next/previous change as a patch identity and finding it again after the re-render. No line-number identity is stable and unique across a stage, though: a deletion shares its new-file number with the rest of its block (so staging one deletion of a block landed back on the block's first line), and in the staged pane the new-file number is the index, which staging/unstaging shifts (so unstaging a modification's deletion missed its replacement line and fell back to an earlier block). The previous worktree-line and adjacent-change-line matching each fixed one case and left another. Do instead what the staging view does: preserve the selection's ordinal among change lines. Read the acted-on line's ordinal from the pane it was in before the op; after the re-render, select the change line at that ordinal in the target pane (clamped to the last). Since the op removes the acted-on change line(s), that ordinal then holds the next surviving change — the next line of the same block, or the next block when a whole block was staged. This needs no reasoning about which side's line numbers are stable, so it handles deletions and the staged pane uniformly. The matching machinery (matchByWorktreeChange, AdjacentChangeLine) is gone; the identity-matched restore (escape, -U preserve) and the new positional restore now share installDiffLineRestore. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| context | ||
| controllers | ||
| filetree | ||
| mergeconflicts | ||
| modes | ||
| patch_exploring | ||
| popup | ||
| presentation | ||
| services/custom_commands | ||
| status | ||
| style | ||
| types | ||
| background.go | ||
| command_log_panel.go | ||
| context.go | ||
| context_config.go | ||
| controllers.go | ||
| dummies.go | ||
| editors.go | ||
| extras_panel.go | ||
| global_handlers.go | ||
| gui.go | ||
| gui_common.go | ||
| gui_driver.go | ||
| information_panel.go | ||
| keybindings.go | ||
| layout.go | ||
| main_panels.go | ||
| menu_panel.go | ||
| options_map.go | ||
| pty.go | ||
| pty_test.go | ||
| recent_repos_panel.go | ||
| side_panels.go | ||
| side_panels_test.go | ||
| tasks_adapter.go | ||
| tasks_adapter_test.go | ||
| test_mode.go | ||
| test_timeout_norace.go | ||
| test_timeout_race.go | ||
| view_helpers.go | ||
| views.go | ||