Documentation ¶
Index ¶
Constants ¶
const ( Shift = "Shift" Alt = "Alt" Ctrl = "Ctrl" Meta = "Meta" EnterStr = "Enter" BackspaceStr = "Backspace" TabStr = "Tab" BackTabStr = "Backtab" EscStr = "Esc" Backspace2Str = "Backspace2" DeleteStr = "Delete" InsertStr = "Insert" UpStr = "Up" DownStr = "Down" LeftStr = "Left" RightStr = "Right" HomeStr = "Home" EndStr = "End" UpLeftStr = "UpLeft" UpRightStr = "UpRight" DownLeftStr = "DownLeft" DownRightStr = "DownRight" CenterStr = "Center" PgDnStr = "PgDn" PgUpStr = "PgUp" ClearStr = "Clear" ExitStr = "Exit" CancelStr = "Cancel" PauseStr = "Pause" PrintStr = "Print" F1Str = "F1" F2Str = "F2" F3Str = "F3" F4Str = "F4" F5Str = "F5" F6Str = "F6" F7Str = "F7" F8Str = "F8" F9Str = "F9" F10Str = "F10" F11Str = "F11" F12Str = "F12" CtrlAStr = "Ctrl-A" CtrlBStr = "Ctrl-B" CtrlCStr = "Ctrl-C" CtrlDStr = "Ctrl-D" CtrlEStr = "Ctrl-E" CtrlFStr = "Ctrl-F" CtrlGStr = "Ctrl-G" CtrlJStr = "Ctrl-J" CtrlKStr = "Ctrl-K" CtrlLStr = "Ctrl-L" CtrlNStr = "Ctrl-N" CtrlOStr = "Ctrl-O" CtrlPStr = "Ctrl-P" CtrlQStr = "Ctrl-Q" CtrlRStr = "Ctrl-R" CtrlSStr = "Ctrl-S" CtrlTStr = "Ctrl-T" CtrlUStr = "Ctrl-U" CtrlVStr = "Ctrl-V" CtrlWStr = "Ctrl-W" CtrlXStr = "Ctrl-X" CtrlYStr = "Ctrl-Y" CtrlZStr = "Ctrl-Z" CtrlSpaceStr = "Ctrl-Space" CtrlUnderscoreStr = "Ctrl-_" CtrlRightSqStr = "Ctrl-]" CtrlBackslashStr = "Ctrl-\\" CtrlCaratStr = "Ctrl-^" )
const ( ModShift term.ModMask = 1 << iota ModCtrl ModAlt ModMeta ModNone term.ModMask = 0 )
These are the modifiers keys that can be sent either with a key press, or a mouse event. Note that as of now, due to the confusion associated with Meta, and the lack of support for it on many/most platforms, the current implementations never use it. Instead, they use ModAlt, even for events that could possibly have been distinguished from ModAlt.
const ( Rune term.Key = iota + 256 Up Down Right Left UpLeft UpRight DownLeft DownRight Center PgUp PgDn Home End Insert Delete Help Exit Clear Cancel Print Pause BackTab F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 )
This is the list of named keys. Rune is special however, in that it is a place holder key indicating that a printable character was sent. The actual value of the rune will be transported in the Rune of the associated KeyEvent.
const ( CtrlSpace term.Key = iota CtrlA CtrlB CtrlC CtrlD CtrlE CtrlF CtrlG CtrlH CtrlI CtrlJ CtrlK CtrlL CtrlM CtrlN CtrlO CtrlP CtrlQ CtrlR CtrlS CtrlT CtrlU CtrlV CtrlW CtrlX CtrlY CtrlZ CtrlLeftSq // Escape CtrlBackslash CtrlRightSq CtrlCarat CtrlUnderscore )
These are the control keys. Note that they overlap with other keys, perhaps. For example, CtrlH is the same as Backspace.
const ( NUL term.Key = iota SOH STX ETX EOT ENQ ACK BEL BS TAB LF VT FF CR SO SI DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US DEL term.Key = 0x7F )
These are the defined ASCII values for key codes. They generally match with KeyCtrl values.
These keys are aliases for other names.
const (
Debug = false
)
Variables ¶
This section is empty.
Functions ¶
func NewEvent ¶
NewEvent attempts to create a suitable event. It parses the various ASCII control sequences if Rune is passed for Key, but if the caller has more precise information it should set that specifically. Callers that aren't sure about modifier state (most) should just pass ModNone.
func NewEventDispatcher ¶
func NewEventDispatcher(opts ...Option) (term.KeyDispatcher, error)
Types ¶
type Option ¶
type Option func(core *eventDispatcher)
Option
func WithFinalizer ¶
WithFinalizer provides a way of calling a function upon dispatcher death
func WithKeyTimerInterval ¶
WithKeyTimerInterval is a functional option to set the interval between key reads, for those of you brave enough to go slower or faster. Default is 50 milliseconds.
func WithTerminalInfo ¶
WithTerminalInfo is mandatory for the composition, provided by core