Skip to content

Commit d50b3e8

Browse files
committed
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.
1 parent ea174ec commit d50b3e8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pkg/gui/controllers/global_controller.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type
5858
Handler: opts.Guards.NoPopupPanel(self.prevScreenMode),
5959
Description: self.c.Tr.PrevScreenMode,
6060
},
61+
{
62+
Key: opts.GetKey(opts.Config.Universal.Return),
63+
Modifier: gocui.ModNone,
64+
Handler: self.escape,
65+
DescriptionFunc: self.escapeDescription,
66+
GetDisabledReason: self.escapeEnabled,
67+
DisplayOnScreen: true,
68+
},
6169
{
6270
ViewName: "",
6371
Key: opts.GetKey(opts.Config.Universal.OptionMenu),
@@ -114,14 +122,6 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type
114122
Modifier: gocui.ModNone,
115123
Handler: self.quitWithoutChangingDirectory,
116124
},
117-
{
118-
Key: opts.GetKey(opts.Config.Universal.Return),
119-
Modifier: gocui.ModNone,
120-
Handler: self.escape,
121-
DescriptionFunc: self.escapeDescription,
122-
GetDisabledReason: self.escapeEnabled,
123-
DisplayOnScreen: true,
124-
},
125125
{
126126
Key: opts.GetKey(opts.Config.Universal.ToggleWhitespaceInDiffView),
127127
Handler: self.toggleWhitespace,

0 commit comments

Comments
 (0)