diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-26 15:02:32 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-27 18:16:16 +1100 |
commit | 98e7ec090509f089a3196848c324fdce2fb462fc (patch) | |
tree | cda5fcc6bf2ee5f442dff68fde121ef9ff3754b9 /pkg/gui/keybindings.go | |
parent | 7128d822cb82beba890aad4dd39e51270598cf0b (diff) |
add type alias for Key
Diffstat (limited to 'pkg/gui/keybindings.go')
-rw-r--r-- | pkg/gui/keybindings.go | 6 |
1 files changed, 3 insertions, 3 deletions
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{ "<c-a>": gocui.KeyCtrlA, "<c-b>": gocui.KeyCtrlB, "<c-c>": 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)] |