summaryrefslogtreecommitdiffstats
path: root/pkg/gui/custom_commands.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-04-04 23:51:59 +1000
committerJesse Duffield <jessedduffield@gmail.com>2021-04-06 19:34:32 +1000
commit4fe512ff3a299102c2bd78bc83b8644582127aae (patch)
tree5a34eacc1c137a8c98624ba29b757c0a717cf694 /pkg/gui/custom_commands.go
parent4197921465a6cb67d5fdd5b63de653493a5ebd41 (diff)
test
type safe view access
Diffstat (limited to 'pkg/gui/custom_commands.go')
-rw-r--r--pkg/gui/custom_commands.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/gui/custom_commands.go b/pkg/gui/custom_commands.go
index 09af7065c..59c08bcf1 100644
--- a/pkg/gui/custom_commands.go
+++ b/pkg/gui/custom_commands.go
@@ -176,9 +176,14 @@ func (gui *Gui) GetCustomCommandKeybindings() []*Binding {
case "":
log.Fatalf("Error parsing custom command keybindings: context not provided (use context: 'global' for the global context). Key: %s, Command: %s", customCommand.Key, customCommand.Command)
default:
- context, ok := gui.contextForContextKey(customCommand.Context)
+ context, ok := gui.contextForContextKey(ContextKey(customCommand.Context))
+ // stupid golang making me build an array of strings for this.
+ allContextKeyStrings := make([]string, len(allContextKeys))
+ for i := range allContextKeys {
+ allContextKeyStrings[i] = string(allContextKeys[i])
+ }
if !ok {
- log.Fatalf("Error when setting custom command keybindings: unknown context: %s. Key: %s, Command: %s.\nPermitted contexts: %s", customCommand.Context, customCommand.Key, customCommand.Command, strings.Join(allContextKeys, ", "))
+ log.Fatalf("Error when setting custom command keybindings: unknown context: %s. Key: %s, Command: %s.\nPermitted contexts: %s", customCommand.Context, customCommand.Key, customCommand.Command, strings.Join(allContextKeyStrings, ", "))
}
// here we assume that a given context will always belong to the same view.
// Currently this is a safe bet but it's by no means guaranteed in the long term