Modifier labels
const ( LabelCtrl = "ctrl" LabelAlt = "alt" LabelMeta = "meta" LabelShift = "shift" )
ErrInvalidKeyEvent is the error returned when encoding or decoding a key event fails.
var ErrInvalidKeyEvent = errors.New("invalid key event")
UnifyEnterKeys is a flag that determines whether or not KPEnter (keypad enter) key events are interpreted as Enter key events. When enabled, Ctrl+J key events are also interpreted as Enter key events.
var UnifyEnterKeys = true
func Decode(s string) (mod tcell.ModMask, key tcell.Key, ch rune, err error)
Decode decodes a string as a key or combination of keys.
func Encode(mod tcell.ModMask, key tcell.Key, ch rune) (string, error)
Encode encodes a key or combination of keys a string.
Configuration maps keys to event handlers and processes key events.
type Configuration struct {
// contains filtered or unexported fields
}
func NewConfiguration() *Configuration
NewConfiguration returns a new input configuration.
func (c *Configuration) Capture(ev *tcell.EventKey) *tcell.EventKey
Capture handles key events.
func (c *Configuration) Clear()
Clear removes all handlers.
func (c *Configuration) Set(s string, handler func(ev *tcell.EventKey) *tcell.EventKey) error
Set sets the handler for a key event string.
func (c *Configuration) SetKey(mod tcell.ModMask, key tcell.Key, handler func(ev *tcell.EventKey) *tcell.EventKey)
SetKey sets the handler for a key.
func (c *Configuration) SetRune(mod tcell.ModMask, ch rune, handler func(ev *tcell.EventKey) *tcell.EventKey)
SetRune sets the handler for a rune.
Name | Synopsis |
---|---|
.. | |
whichkeybind |