mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-12 16:46:25 -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> |
||
|---|---|---|
| .. | ||
| 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 | ||