Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/gui/controllers/suggestions_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func (self *SuggestionsController) GetKeybindings(opts types.KeybindingsOpts) []
Handler: func() error {
return self.context().State.OnDeleteSuggestion()
},
GetDisabledReason: self.require(self.singleItemSelected()),
},
{
Keys: opts.GetKeys(opts.Config.Universal.Edit),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package shell_commands

import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)

var DeleteSuggestionWhenNoneSelected = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Press the delete key again after deleting the last entry in the shell command history",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {},
SetupConfig: func(cfg *config.AppConfig) {},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.GlobalPress(keys.Universal.ExecuteShellCommand)
t.ExpectPopup().Prompt().
Title(Equals("Shell command:")).
Type("echo 1").
Confirm()

// Deleting the only suggestion leaves the list focused but empty, so
// there is nothing for a second delete to act on.
t.GlobalPress(keys.Universal.ExecuteShellCommand)
t.ExpectPopup().Prompt().
Title(Equals("Shell command:")).
SuggestionLines(Contains("echo 1")).
DeleteSuggestion(Contains("echo 1"))

t.Views().Suggestions().
IsFocused().
IsEmpty().
Press(keys.Universal.Remove)

t.ExpectToast(Equals("Disabled: No item selected"))
},
})
1 change: 1 addition & 0 deletions pkg/integration/tests/test_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ var tests = []*components.IntegrationTest{
shell_commands.BasicShellCommand,
shell_commands.ComplexShellCommand,
shell_commands.DeleteFromHistory,
shell_commands.DeleteSuggestionWhenNoneSelected,
shell_commands.EditHistory,
shell_commands.History,
shell_commands.OmitFromHistory,
Expand Down