summaryrefslogtreecommitdiffstats
path: root/pkg/gui
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-09-27 11:04:57 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-09-27 11:11:55 +1000
commit12f9b1416fdf06871f54f5027a56749600599080 (patch)
treefa3cc4f60763c0be7e4449090ebed7a56c17dba9 /pkg/gui
parent4dad7064cc48a1e6bf0504aa9d8745ab29f8e78e (diff)
better handling of global custom keybindings
Diffstat (limited to 'pkg/gui')
-rw-r--r--pkg/gui/custom_commands.go4
-rw-r--r--pkg/gui/options_menu_panel.go2
2 files changed, 4 insertions, 2 deletions
diff --git a/pkg/gui/custom_commands.go b/pkg/gui/custom_commands.go
index 655e1771f..034dd3381 100644
--- a/pkg/gui/custom_commands.go
+++ b/pkg/gui/custom_commands.go
@@ -212,6 +212,7 @@ func (gui *Gui) GetCustomCommandKeybindings() []*Binding {
for _, customCommand := range customCommands {
var viewName string
+ var contexts []string
switch customCommand.Context {
case "global":
viewName = ""
@@ -226,11 +227,12 @@ func (gui *Gui) GetCustomCommandKeybindings() []*Binding {
// Currently this is a safe bet but it's by no means guaranteed in the long term
// and we might need to make some changes in the future to support it.
viewName = context.GetViewName()
+ contexts = []string{customCommand.Context}
}
bindings = append(bindings, &Binding{
ViewName: viewName,
- Contexts: []string{customCommand.Context},
+ Contexts: contexts,
Key: gui.getKey(customCommand.Key),
Modifier: gocui.ModNone,
Handler: gui.wrappedHandler(gui.handleCustomCommandKeybinding(customCommand)),
diff --git a/pkg/gui/options_menu_panel.go b/pkg/gui/options_menu_panel.go
index 5211d34ea..9027685a9 100644
--- a/pkg/gui/options_menu_panel.go
+++ b/pkg/gui/options_menu_panel.go
@@ -12,7 +12,7 @@ func (gui *Gui) getBindings(v *gocui.View) []*Binding {
bindingsGlobal, bindingsPanel []*Binding
)
- bindings := append(gui.GetInitialKeybindings(), gui.GetCustomCommandKeybindings()...)
+ bindings := append(gui.GetCustomCommandKeybindings(), gui.GetInitialKeybindings()...)
for _, binding := range bindings {
if GetKeyDisplay(binding.Key) != "" && binding.Description != "" {