1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-23 12:18:51 +02:00

accept umlaut keybindings

This commit is contained in:
Jesse Duffield 2020-08-12 19:19:32 +10:00
parent bfaf1c4f70
commit 27cd12e2d9

View File

@ -4,6 +4,8 @@ import (
"log" "log"
"strings" "strings"
"unicode/utf8"
"github.com/jesseduffield/gocui" "github.com/jesseduffield/gocui"
) )
@ -178,14 +180,15 @@ func GetKeyDisplay(key interface{}) string {
func (gui *Gui) getKey(name string) interface{} { func (gui *Gui) getKey(name string) interface{} {
key := gui.Config.GetUserConfig().GetString("keybinding." + name) key := gui.Config.GetUserConfig().GetString("keybinding." + name)
if len(key) > 1 { runeCount := utf8.RuneCountInString(key)
if runeCount > 1 {
binding := keymap[strings.ToLower(key)] binding := keymap[strings.ToLower(key)]
if binding == nil { if binding == nil {
log.Fatalf("Unrecognized key %s for keybinding %s", strings.ToLower(key), name) log.Fatalf("Unrecognized key %s for keybinding %s", strings.ToLower(key), name)
} else { } else {
return binding return binding
} }
} else if len(key) == 1 { } else if runeCount == 1 {
return []rune(key)[0] return []rune(key)[0]
} }
log.Fatal("Key empty for keybinding: " + strings.ToLower(name)) log.Fatal("Key empty for keybinding: " + strings.ToLower(name))