add type alias for Key

This commit is contained in:
Jesse Duffield
2022-03-26 15:02:32 +11:00
parent 7128d822cb
commit 98e7ec0905
5 changed files with 10 additions and 8 deletions

View File

@@ -97,7 +97,7 @@ type OnFocusOpts struct {
type ContextKey string
type KeybindingsOpts struct {
GetKey func(key string) interface{}
GetKey func(key string) Key
Config config.KeybindingConfig
Guards KeybindingGuards
}

View File

@@ -2,6 +2,8 @@ package types
import "github.com/jesseduffield/gocui"
type Key interface{} // FIXME: find out how to get `gocui.Key | rune`
// Binding - a keybinding mapping a key and modifier to a handler. The keypress
// is only handled if the given view has focus, or handled globally if the view
// is ""
@@ -9,7 +11,7 @@ type Binding struct {
ViewName string
Contexts []string
Handler func() error
Key interface{} // FIXME: find out how to get `gocui.Key | rune`
Key Key
Modifier gocui.Modifier
Description string
Alternative string