mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-09-16 09:16:26 +02:00
Move global escape handler to before the keybindings menu handler
The main reason for this is that sometimes the escape key is handled by a local binding, in which case it appears before the '?' binding in the options status bar, and other times it is handled by the global controller, in which case it appeared after. Moving it to before the keybindings menu handler makes it appear before '?' in both cases. Also, if the window is too narrow to show all keybindings, the ones that don't fit will be truncated, and in this case it is more important to show the esc binding because of its context sensitivity. This also moves the esc entry up a few positions in the keybindings menu, but I don't think this matters much.
This commit is contained in:
@@ -58,6 +58,15 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type
|
||||
Handler: opts.Guards.NoPopupPanel(self.prevScreenMode),
|
||||
Description: self.c.Tr.PrevScreenMode,
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Universal.Return),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.escape,
|
||||
Description: self.c.Tr.Cancel,
|
||||
DescriptionFunc: self.escapeDescription,
|
||||
GetDisabledReason: self.escapeEnabled,
|
||||
DisplayOnScreen: true,
|
||||
},
|
||||
{
|
||||
ViewName: "",
|
||||
Key: opts.GetKey(opts.Config.Universal.OptionMenu),
|
||||
@@ -114,15 +123,6 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.quitWithoutChangingDirectory,
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Universal.Return),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.escape,
|
||||
Description: self.c.Tr.Cancel,
|
||||
DescriptionFunc: self.escapeDescription,
|
||||
GetDisabledReason: self.escapeEnabled,
|
||||
DisplayOnScreen: true,
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Universal.ToggleWhitespaceInDiffView),
|
||||
Handler: self.toggleWhitespace,
|
||||
|
Reference in New Issue
Block a user