summaryrefslogtreecommitdiffstats
path: root/pkg/gui/controllers/custom_command_action.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gui/controllers/custom_command_action.go')
-rw-r--r--pkg/gui/controllers/custom_command_action.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/pkg/gui/controllers/custom_command_action.go b/pkg/gui/controllers/custom_command_action.go
index bd24cda7d..bc595934d 100644
--- a/pkg/gui/controllers/custom_command_action.go
+++ b/pkg/gui/controllers/custom_command_action.go
@@ -20,15 +20,12 @@ func (self *CustomCommandAction) Call() error {
HandleConfirm: func(command string) error {
if self.shouldSaveCommand(command) {
self.c.GetAppState().CustomCommandsHistory = utils.Limit(
- lo.Uniq(append(self.c.GetAppState().CustomCommandsHistory, command)),
+ lo.Uniq(append([]string{command}, self.c.GetAppState().CustomCommandsHistory...)),
1000,
)
}
- err := self.c.SaveAppState()
- if err != nil {
- self.c.Log.Error(err)
- }
+ self.c.SaveAppStateAndLogError()
self.c.LogAction(self.c.Tr.Actions.CustomCommand)
return self.c.RunSubprocessAndRefresh(
@@ -39,8 +36,7 @@ func (self *CustomCommandAction) Call() error {
}
func (self *CustomCommandAction) GetCustomCommandsHistorySuggestionsFunc() func(string) []*types.Suggestion {
- // reversing so that we display the latest command first
- history := lo.Reverse(self.c.GetAppState().CustomCommandsHistory)
+ history := self.c.GetAppState().CustomCommandsHistory
return helpers.FuzzySearchFunc(history)
}