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> |
||
|---|---|---|
| .. | ||
| 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 | ||