From 98e7ec090509f089a3196848c324fdce2fb462fc Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 26 Mar 2022 15:02:32 +1100 Subject: add type alias for Key --- pkg/gui/keybindings.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pkg/gui/keybindings.go') diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index e19f42935..8f70045d0 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -76,7 +76,7 @@ var keyMapReversed = map[gocui.Key]string{ gocui.MouseWheelDown: "mouse wheel down", } -var keymap = map[string]interface{}{ +var keymap = map[string]types.Key{ "": gocui.KeyCtrlA, "": gocui.KeyCtrlB, "": gocui.KeyCtrlC, @@ -153,7 +153,7 @@ func (gui *Gui) getKeyDisplay(name string) string { return GetKeyDisplay(key) } -func GetKeyDisplay(key interface{}) string { +func GetKeyDisplay(key types.Key) string { keyInt := 0 switch key := key.(type) { @@ -170,7 +170,7 @@ func GetKeyDisplay(key interface{}) string { return fmt.Sprintf("%c", keyInt) } -func (gui *Gui) getKey(key string) interface{} { +func (gui *Gui) getKey(key string) types.Key { runeCount := utf8.RuneCountInString(key) if runeCount > 1 { binding := keymap[strings.ToLower(key)] -- cgit v1.2.3