jesseduffield.lazygit/pkg/integration/tests/shell_commands
Uzair Aftab c3c346e430 Don't delete a suggestion when there is no suggestion selected
Deleting the last entry in the shell command history leaves the
suggestions list focused but empty. An empty list reports its selected
index as -1 (ListCursor.clampValue), and the delete keybinding passes
that index straight to HandleDeleteSuggestion, which subscripts
GetItems() with it. Pressing delete a second time panics and takes
lazygit down with it.

To reproduce: press ":" and run any command, press ":" again, tab into
the suggestions, then press "d" twice.

The handler two lines below already returns early on a -1, with a
comment saying it should never happen. That index comes from lo.IndexOf,
so this one never got the same scrutiny.

We guard the binding the way ConfirmSuggestion directly above it is
already guarded, with singleItemSelected. The key is then disabled with
the usual reason instead of firing on an empty list
2026-09-01 12:48:34 +02:00
..
basic_shell_command.go Rename "Custom Command" to "Shell Command" 2024-08-17 10:56:03 +02:00
complex_shell_command.go Rename "Custom Command" to "Shell Command" 2024-08-17 10:56:03 +02:00
delete_from_history.go Rename "Custom Command" to "Shell Command" 2024-08-17 10:56:03 +02:00
delete_suggestion_when_none_selected.go Don't delete a suggestion when there is no suggestion selected 2026-09-01 12:48:34 +02:00
edit_history.go Rename "Custom Command" to "Shell Command" 2024-08-17 10:56:03 +02:00
history.go Rename "Custom Command" to "Shell Command" 2024-08-17 10:56:03 +02:00
omit_from_history.go Rename "Custom Command" to "Shell Command" 2024-08-17 10:56:03 +02:00