diff --git a/pkg/gui/controllers/suggestions_controller.go b/pkg/gui/controllers/suggestions_controller.go index 857952d9b..90ac43107 100644 --- a/pkg/gui/controllers/suggestions_controller.go +++ b/pkg/gui/controllers/suggestions_controller.go @@ -40,11 +40,8 @@ func (self *SuggestionsController) GetKeybindings(opts types.KeybindingsOpts) [] Handler: func() error { return self.context().State.OnClose() }, }, { - Key: opts.GetKey(opts.Config.Universal.TogglePanel), - Handler: func() error { - self.c.Views().Suggestions.Subtitle = "" - return self.c.ReplaceContext(self.c.Contexts().Confirmation) - }, + Key: opts.GetKey(opts.Config.Universal.TogglePanel), + Handler: self.switchToConfirmation, }, { Key: opts.GetKey(opts.Config.Universal.Remove), @@ -61,7 +58,7 @@ func (self *SuggestionsController) GetKeybindings(opts types.KeybindingsOpts) [] self.c.Contexts().Confirmation.GetView().TextArea.TypeString(selectedItem.Value) self.c.Contexts().Confirmation.GetView().RenderTextArea() self.c.Contexts().Suggestions.RefreshSuggestions() - return self.c.ReplaceContext(self.c.Contexts().Confirmation) + return self.switchToConfirmation() } } return nil @@ -72,6 +69,11 @@ func (self *SuggestionsController) GetKeybindings(opts types.KeybindingsOpts) [] return bindings } +func (self *SuggestionsController) switchToConfirmation() error { + self.c.Views().Suggestions.Subtitle = "" + return self.c.ReplaceContext(self.c.Contexts().Confirmation) +} + func (self *SuggestionsController) GetOnFocusLost() func(types.OnFocusLostOpts) error { return func(types.OnFocusLostOpts) error { self.c.Helpers().Confirmation.DeactivateConfirmationPrompt()