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
@ -40,11 +40,8 @@ func (self *SuggestionsController) GetKeybindings(opts types.KeybindingsOpts) []
|
|||||||
Handler: func() error { return self.context().State.OnClose() },
|
Handler: func() error { return self.context().State.OnClose() },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
|
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
|
||||||
Handler: func() error {
|
Handler: self.switchToConfirmation,
|
||||||
self.c.Views().Suggestions.Subtitle = ""
|
|
||||||
return self.c.ReplaceContext(self.c.Contexts().Confirmation)
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Key: opts.GetKey(opts.Config.Universal.Remove),
|
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().TextArea.TypeString(selectedItem.Value)
|
||||||
self.c.Contexts().Confirmation.GetView().RenderTextArea()
|
self.c.Contexts().Confirmation.GetView().RenderTextArea()
|
||||||
self.c.Contexts().Suggestions.RefreshSuggestions()
|
self.c.Contexts().Suggestions.RefreshSuggestions()
|
||||||
return self.c.ReplaceContext(self.c.Contexts().Confirmation)
|
return self.switchToConfirmation()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -72,6 +69,11 @@ func (self *SuggestionsController) GetKeybindings(opts types.KeybindingsOpts) []
|
|||||||
return bindings
|
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 {
|
func (self *SuggestionsController) GetOnFocusLost() func(types.OnFocusLostOpts) error {
|
||||||
return func(types.OnFocusLostOpts) error {
|
return func(types.OnFocusLostOpts) error {
|
||||||
self.c.Helpers().Confirmation.DeactivateConfirmationPrompt()
|
self.c.Helpers().Confirmation.DeactivateConfirmationPrompt()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user