mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-12 00:26:24 -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> |
||
|---|---|---|
| .. | ||
| apply.go | ||
| apply_in_reverse.go | ||
| apply_in_reverse_with_conflict.go | ||
| apply_with_modified_file_conflict.go | ||
| apply_with_modified_file_no_conflict.go | ||
| build_from_main_view.go | ||
| build_from_main_view_with_unsupported_pager.go | ||
| build_from_whole_commit_main_view.go | ||
| build_multi_file_from_whole_commit_main_view.go | ||
| copy_renamed_file_diff.go | ||
| discard_lines_from_commit.go | ||
| discard_lines_from_commit_main_view.go | ||
| edit_line_in_patch_building_panel.go | ||
| keep_selection_after_moving_patch_out_main_view.go | ||
| move_range_to_index.go | ||
| move_to_earlier_commit.go | ||
| move_to_earlier_commit_from_added_file.go | ||
| move_to_index.go | ||
| move_to_index_from_added_file_with_conflict.go | ||
| move_to_index_part_of_adjacent_added_lines.go | ||
| move_to_index_partial.go | ||
| move_to_index_with_conflict.go | ||
| move_to_index_with_modified_file.go | ||
| move_to_index_works_even_if_noprefix_is_set.go | ||
| move_to_later_commit.go | ||
| move_to_later_commit_partial_hunk.go | ||
| move_to_new_commit.go | ||
| move_to_new_commit_before.go | ||
| move_to_new_commit_from_added_file.go | ||
| move_to_new_commit_from_deleted_file.go | ||
| move_to_new_commit_in_last_commit_of_stacked_branch.go | ||
| move_to_new_commit_partial_hunk.go | ||
| remove_from_commit.go | ||
| remove_parts_of_added_file.go | ||
| rename_similarity_threshold_change.go | ||
| renamed_file_partial.go | ||
| renamed_file_whole.go | ||
| reset_patch_built_from_main_view.go | ||
| reset_with_escape.go | ||
| select_all_files.go | ||
| select_direcories_sharing_prefix.go | ||
| specific_selection.go | ||
| start_new_patch.go | ||
| toggle_directory.go | ||
| toggle_range.go | ||