Documentation
¶
Overview ¶
Package keys maps raw input onto semantic actions and footer hint legends for viewkit applications.
Index ¶
- func ControlKeys(in []string) []string
- func DisplayName(key string) string
- func Keys() []string
- func Normalize(key string) string
- func Register(key, name string, s Scheme)
- func Resolve(binds map[string]string, key string) (target string, ok bool)
- func Use(s Scheme)
- type Action
- type Binding
- type Map
- type Scheme
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ControlKeys ¶ added in v0.1.6
ControlKeys filters a binding's keys down to the multi-rune ones ("tab", "ctrl+s", "esc"), dropping single characters. Text-entry contexts use it so ordinary typing is not swallowed by navigation bindings.
func DisplayName ¶ added in v0.0.1
func Normalize ¶ added in v0.1.6
Normalize canonicalizes a key name for comparison, folding case and trimming surrounding whitespace.
Types ¶
type Action ¶
type Action string
const ( Up Action = "nav.up" Down Action = "nav.down" Left Action = "nav.left" Right Action = "nav.right" Confirm Action = "confirm" Cancel Action = "cancel" Quit Action = "quit" FocusNext Action = "focus.next" FocusPrev Action = "focus.prev" Inc Action = "inc" Dec Action = "dec" Erase Action = "erase" PageUp Action = "page.up" PageDown Action = "page.down" Open Action = "open" Reload Action = "reload" // Complete accepts the suggestion a text field is showing. It shares tab // with FocusNext: a host that binds both resolves the conflict by build // order, and one that binds Complete alone gets tab-to-accept for free. Complete Action = "complete" CompleteNext Action = "complete.next" CompletePrev Action = "complete.prev" )
type Binding ¶
func (Binding) DisplayGlyph ¶
type Scheme ¶
type Scheme struct {
// contains filtered or unexported fields
}
func (Scheme) EditorBindings ¶ added in v0.1.6
EditorBindings resolves actions against s and strips their single-character keys, yielding the subset safe to bind while a text field has focus. Actions left with no keys are omitted.