summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-08-12 19:19:32 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-08-12 20:07:56 +1000
commit27cd12e2d917aadcd5b023f4fce8d8248c491c8c (patch)
tree74deb4f7a30194827aabeab1f53406fdc17849e1
parentbfaf1c4f709505cb60b9f4c9cb813a4c816b7fec (diff)
accept umlaut keybindingsv0.21
-rw-r--r--pkg/gui/keybindings.go7
1 files 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))