mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-11 08:06:25 -04:00
Wire the focused main view's `d` binding to a DiscardSelection action on the side panel beneath, the discard counterpart of the primary action. As with stage/toggle, what discard means is the panel's business: - the files panel discards from the working tree, mirroring the staging view's `d` — reverse-apply not cached on the unstaged side (destructive, so confirmed), reverse-apply cached on the staged side (i.e. unstage); - the commit panels (commit files, and the whole-commit diff of the local commits / sub-commits / stash panels) remove the selected lines from the commit via a rebase, mirroring the patch builder's "discard lines from commit" — building a one-off patch from the selection and deleting it. The commit-discard backend and its guard are shared free functions in patch_building_from_main_view.go, paralleling the patch toggle. Discarding from a commit is only possible on a local branch, so DiscardSelection grows a disabled-reason companion on the FocusedMainViewActions interface: the `d` binding is greyed with a reason on stash and other-branch sub-commits (never rebaseable) and while a rebase is in progress, exactly as the patch builder greys it. The files panel is always available (a zero-context diff is the one error it reports inline, matching the staging view). 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_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 | ||
| 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 | ||