diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-02-05 10:31:07 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-17 19:13:40 +1100 |
commit | 226985bf7602763f7578ef236bdc4cec3a1494e9 (patch) | |
tree | 3a12b9d41099902e411fe32df3b79d31e8a8f375 /pkg/gui/types/context.go | |
parent | 2db463681564e8db945cd6811fc633545ee9fd83 (diff) |
refactor keybindings
Diffstat (limited to 'pkg/gui/types/context.go')
-rw-r--r-- | pkg/gui/types/context.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/pkg/gui/types/context.go b/pkg/gui/types/context.go index fcbadfd22..e4a11779e 100644 --- a/pkg/gui/types/context.go +++ b/pkg/gui/types/context.go @@ -28,6 +28,9 @@ type IBaseContext interface { GetKey() ContextKey GetOptionsMap() map[string]string + + GetKeybindings(opts KeybindingsOpts) []*Binding + AddKeybindingsFn(KeybindingsFn) } type Context interface { @@ -46,12 +49,16 @@ type OnFocusOpts struct { type ContextKey string +type KeybindingsOpts struct { + GetKey func(key string) interface{} + Config config.KeybindingConfig + Guards KeybindingGuards +} + +type KeybindingsFn func(opts KeybindingsOpts) []*Binding + type HasKeybindings interface { - Keybindings( - getKey func(key string) interface{}, - config config.KeybindingConfig, - guards KeybindingGuards, - ) []*Binding + GetKeybindings(opts KeybindingsOpts) []*Binding } type IController interface { |