mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-23 12:18:51 +02:00
Extract helper function SuggestionsController.switchToConfirmation
This fixes the minor issue that the subtitle of the suggestions view wasn't emptied when hitting "e" to edit a custom command.
This commit is contained in:
parent
696b8ba457
commit
c3715d0f86
@ -41,10 +41,7 @@ func (self *SuggestionsController) GetKeybindings(opts types.KeybindingsOpts) []
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
|
||||
Handler: func() error {
|
||||
self.c.Views().Suggestions.Subtitle = ""
|
||||
return self.c.ReplaceContext(self.c.Contexts().Confirmation)
|
||||
},
|
||||
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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user