Documentation ¶
Overview ¶
Package key implements generic key definition.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Key ¶
type Key int
Key represents a non-character key.
const ( None Key = iota Enter Escape Space Tab Meta F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 Backspace Delete Insert Home End PageUp PageDown Up Down Left Right )
Known non-character keys.
Keys between None and Meta are not meta keys as they can be represented with a character, e.g. \n, \i, ' ', \t.
func StringToKey ¶
StringToKey parses the string presentation of a key back into a Key.
Returns None on invalid key name.
type Press ¶
type Press struct { Alt bool Ctrl bool Key Key // Non-character key (e.g. F-keys, arrows, tab, space, etc). Set to None when not used. Ch rune // Character key, e.g. letter, number. Set to rune(0) when not used. }
Press represents a key press.
Only one of Key or Ch is set.
func StringToPress ¶
StringToPress parses a string and returns a Press.
func (Press) IsMeta ¶
IsMeta returns true if a key press is a meta key. This also includes characters with Ctrl or Alt held.
Click to show internal directories.
Click to hide internal directories.