36 lines
845 B
Go
36 lines
845 B
Go
package editor
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// !Terminal Input Escape Code Sequences
|
|
// ----------------------------------------------------------------------------
|
|
|
|
const(
|
|
KeyArrowUp = "A"
|
|
KeyArrowDown = "B"
|
|
KeyArrowRight = "C"
|
|
KeyArrowLeft = "D"
|
|
KeyPageUp = "5~"
|
|
KeyPageDown = "6~"
|
|
)
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// !Map escape sequences to simpler constants
|
|
// ----------------------------------------------------------------------------
|
|
|
|
const (
|
|
keyUp = '↑'
|
|
keyDown = '↓'
|
|
keyLeft = '←'
|
|
keyRight = '→'
|
|
keyPageUp = '⭱'
|
|
keyPageDown = '⭳'
|
|
)
|
|
|
|
var keyMap = map[string]rune{
|
|
KeyArrowUp: keyUp,
|
|
KeyArrowDown: keyDown,
|
|
KeyArrowLeft: keyLeft,
|
|
KeyArrowRight: keyRight,
|
|
KeyPageUp: keyPageUp,
|
|
KeyPageDown: keyPageDown,
|
|
} |