From 27cd12e2d917aadcd5b023f4fce8d8248c491c8c Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 12 Aug 2020 19:19:32 +1000 Subject: [PATCH] accept umlaut keybindings --- pkg/gui/keybindings.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 66d9f086f..6d7273e49 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -4,6 +4,8 @@ import ( "log" "strings" + "unicode/utf8" + "github.com/jesseduffield/gocui" ) @@ -178,14 +180,15 @@ func GetKeyDisplay(key interface{}) string { func (gui *Gui) getKey(name string) interface{} { key := gui.Config.GetUserConfig().GetString("keybinding." + name) - if len(key) > 1 { + runeCount := utf8.RuneCountInString(key) + if runeCount > 1 { binding := keymap[strings.ToLower(key)] if binding == nil { log.Fatalf("Unrecognized key %s for keybinding %s", strings.ToLower(key), name) } else { return binding } - } else if len(key) == 1 { + } else if runeCount == 1 { return []rune(key)[0] } log.Fatal("Key empty for keybinding: " + strings.ToLower(name))