mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-11 16:16:28 -04:00
Dropping a hunk with `d` re-establishes the focused main view's selection on the next surviving change, which feels great. But other operations that rewrite the commit under the focused main view — moving a custom patch out into the index, undoing right after a discard or a patch move — don't run through the focused-main-view action handlers, so nothing was preserving the selection. The stale gocui selection was left painted over the new content, often as a large, now-meaningless range. Rather than teach every such command to capture and restore the selection (move-patch, undo, redo, and any future one), the focused main view now preserves it itself, by its change-line ordinal, as the diff re-renders — the command-agnostic counterpart of revealSelectionAfterPrimaryAction. The diff side panels call it from their render-to-main before triggering the render, so the restore rides the re-render. It stands down unless the focused main view is current and shows a selection, no precise restore is already pending (escape / post-stage reveal / context-size place the selection more precisely), and the diff command is actually changing. That last gate matters: a plain background refresh re-renders the same commit's diff unchanged, and there the selection — range and all — must be left alone; only a command change (e.g. a rebase rewriting the commit's hash) means the content moved. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| bisect | ||
| branch | ||
| cherry_pick | ||
| commit | ||
| config | ||
| conflicts | ||
| custom_commands | ||
| demo | ||
| diff | ||
| file | ||
| filter_and_search | ||
| filter_by_author | ||
| filter_by_path | ||
| interactive_rebase | ||
| misc | ||
| patch_building | ||
| reflog | ||
| remote | ||
| shared | ||
| shell_commands | ||
| staging | ||
| stash | ||
| status | ||
| submodule | ||
| sync | ||
| tag | ||
| ui | ||
| undo | ||
| worktree | ||
| test_list.go | ||
| test_list_generator.go | ||
| tests.go | ||