2021-03-26 12:01:17 -04:00
|
|
|
package editor
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// !Terminal Input Escape Code Sequences
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
const(
|
|
|
|
KeyArrowUp = "A"
|
|
|
|
KeyArrowDown = "B"
|
|
|
|
KeyArrowRight = "C"
|
|
|
|
KeyArrowLeft = "D"
|
2021-03-30 14:42:59 -04:00
|
|
|
KeyPageUp = "5~"
|
|
|
|
KeyPageDown = "6~"
|
2021-03-26 12:01:17 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// !Map escape sequences to simpler constants
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
const (
|
2021-03-26 13:35:58 -04:00
|
|
|
keyUp = '↑'
|
|
|
|
keyDown = '↓'
|
|
|
|
keyLeft = '←'
|
|
|
|
keyRight = '→'
|
2021-03-30 14:42:59 -04:00
|
|
|
keyPageUp = '⭱'
|
|
|
|
keyPageDown = '⭳'
|
2021-03-26 12:01:17 -04:00
|
|
|
)
|
|
|
|
|
2021-03-26 13:35:58 -04:00
|
|
|
var keyMap = map[string]rune{
|
2021-03-26 12:01:17 -04:00
|
|
|
KeyArrowUp: keyUp,
|
|
|
|
KeyArrowDown: keyDown,
|
|
|
|
KeyArrowLeft: keyLeft,
|
|
|
|
KeyArrowRight: keyRight,
|
2021-03-30 14:42:59 -04:00
|
|
|
KeyPageUp: keyPageUp,
|
|
|
|
KeyPageDown: keyPageDown,
|
2021-03-26 12:01:17 -04:00
|
|
|
}
|