fixes #323 Missing termbox key binding

This commit is contained in:
Garrett D'Amore 2020-01-13 21:30:48 -08:00
parent de4e5c4494
commit ef4e0a2e86
1 changed files with 79 additions and 59 deletions

View File

@ -1,4 +1,4 @@
// Copyright 2016 The TCell Authors // Copyright 2020 The TCell Authors
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use file except in compliance with the License. // you may not use file except in compliance with the License.
@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// Package termbox is a compatibility layer to allow tcells to emulate // Package termbox is a compatibility layer to allow tcell to emulate
// the github.com/nsf/termbox package. // the github.com/nsf/termbox package.
package termbox package termbox
@ -236,63 +236,83 @@ const (
// Keys codes. // Keys codes.
const ( const (
KeyF1 = Key(tcell.KeyF1) KeyF1 = Key(tcell.KeyF1)
KeyF2 = Key(tcell.KeyF2) KeyF2 = Key(tcell.KeyF2)
KeyF3 = Key(tcell.KeyF3) KeyF3 = Key(tcell.KeyF3)
KeyF4 = Key(tcell.KeyF4) KeyF4 = Key(tcell.KeyF4)
KeyF5 = Key(tcell.KeyF5) KeyF5 = Key(tcell.KeyF5)
KeyF6 = Key(tcell.KeyF6) KeyF6 = Key(tcell.KeyF6)
KeyF7 = Key(tcell.KeyF7) KeyF7 = Key(tcell.KeyF7)
KeyF8 = Key(tcell.KeyF8) KeyF8 = Key(tcell.KeyF8)
KeyF9 = Key(tcell.KeyF9) KeyF9 = Key(tcell.KeyF9)
KeyF10 = Key(tcell.KeyF10) KeyF10 = Key(tcell.KeyF10)
KeyF11 = Key(tcell.KeyF11) KeyF11 = Key(tcell.KeyF11)
KeyF12 = Key(tcell.KeyF12) KeyF12 = Key(tcell.KeyF12)
KeyInsert = Key(tcell.KeyInsert) KeyInsert = Key(tcell.KeyInsert)
KeyDelete = Key(tcell.KeyDelete) KeyDelete = Key(tcell.KeyDelete)
KeyHome = Key(tcell.KeyHome) KeyHome = Key(tcell.KeyHome)
KeyEnd = Key(tcell.KeyEnd) KeyEnd = Key(tcell.KeyEnd)
KeyArrowUp = Key(tcell.KeyUp) KeyArrowUp = Key(tcell.KeyUp)
KeyArrowDown = Key(tcell.KeyDown) KeyArrowDown = Key(tcell.KeyDown)
KeyArrowRight = Key(tcell.KeyRight) KeyArrowRight = Key(tcell.KeyRight)
KeyArrowLeft = Key(tcell.KeyLeft) KeyArrowLeft = Key(tcell.KeyLeft)
KeyCtrlA = Key(tcell.KeyCtrlA) KeyCtrlA = Key(tcell.KeyCtrlA)
KeyCtrlB = Key(tcell.KeyCtrlB) KeyCtrlB = Key(tcell.KeyCtrlB)
KeyCtrlC = Key(tcell.KeyCtrlC) KeyCtrlC = Key(tcell.KeyCtrlC)
KeyCtrlD = Key(tcell.KeyCtrlD) KeyCtrlD = Key(tcell.KeyCtrlD)
KeyCtrlE = Key(tcell.KeyCtrlE) KeyCtrlE = Key(tcell.KeyCtrlE)
KeyCtrlF = Key(tcell.KeyCtrlF) KeyCtrlF = Key(tcell.KeyCtrlF)
KeyCtrlG = Key(tcell.KeyCtrlG) KeyCtrlG = Key(tcell.KeyCtrlG)
KeyCtrlH = Key(tcell.KeyCtrlH) KeyCtrlH = Key(tcell.KeyCtrlH)
KeyCtrlI = Key(tcell.KeyCtrlI) KeyCtrlI = Key(tcell.KeyCtrlI)
KeyCtrlJ = Key(tcell.KeyCtrlJ) KeyCtrlJ = Key(tcell.KeyCtrlJ)
KeyCtrlK = Key(tcell.KeyCtrlK) KeyCtrlK = Key(tcell.KeyCtrlK)
KeyCtrlL = Key(tcell.KeyCtrlL) KeyCtrlL = Key(tcell.KeyCtrlL)
KeyCtrlM = Key(tcell.KeyCtrlM) KeyCtrlM = Key(tcell.KeyCtrlM)
KeyCtrlN = Key(tcell.KeyCtrlN) KeyCtrlN = Key(tcell.KeyCtrlN)
KeyCtrlO = Key(tcell.KeyCtrlO) KeyCtrlO = Key(tcell.KeyCtrlO)
KeyCtrlP = Key(tcell.KeyCtrlP) KeyCtrlP = Key(tcell.KeyCtrlP)
KeyCtrlQ = Key(tcell.KeyCtrlQ) KeyCtrlQ = Key(tcell.KeyCtrlQ)
KeyCtrlR = Key(tcell.KeyCtrlR) KeyCtrlR = Key(tcell.KeyCtrlR)
KeyCtrlS = Key(tcell.KeyCtrlS) KeyCtrlS = Key(tcell.KeyCtrlS)
KeyCtrlT = Key(tcell.KeyCtrlT) KeyCtrlT = Key(tcell.KeyCtrlT)
KeyCtrlU = Key(tcell.KeyCtrlU) KeyCtrlU = Key(tcell.KeyCtrlU)
KeyCtrlV = Key(tcell.KeyCtrlV) KeyCtrlV = Key(tcell.KeyCtrlV)
KeyCtrlW = Key(tcell.KeyCtrlW) KeyCtrlW = Key(tcell.KeyCtrlW)
KeyCtrlX = Key(tcell.KeyCtrlX) KeyCtrlX = Key(tcell.KeyCtrlX)
KeyCtrlY = Key(tcell.KeyCtrlY) KeyCtrlY = Key(tcell.KeyCtrlY)
KeyCtrlZ = Key(tcell.KeyCtrlZ) KeyCtrlZ = Key(tcell.KeyCtrlZ)
KeyBackspace = Key(tcell.KeyBackspace) KeyCtrlUnderscore = Key(tcell.KeyCtrlUnderscore)
KeyBackspace2 = Key(tcell.KeyBackspace2) KeyBackspace = Key(tcell.KeyBackspace)
KeyTab = Key(tcell.KeyTab) KeyBackspace2 = Key(tcell.KeyBackspace2)
KeyEnter = Key(tcell.KeyEnter) KeyTab = Key(tcell.KeyTab)
KeyEsc = Key(tcell.KeyEscape) KeyEnter = Key(tcell.KeyEnter)
KeyPgdn = Key(tcell.KeyPgDn) KeyEsc = Key(tcell.KeyEscape)
KeyPgup = Key(tcell.KeyPgUp) KeyPgdn = Key(tcell.KeyPgDn)
MouseLeft = Key(tcell.KeyF63) // arbitrary assignments KeyPgup = Key(tcell.KeyPgUp)
MouseRight = Key(tcell.KeyF62) KeySpace = Key(tcell.Key(' '))
MouseMiddle = Key(tcell.KeyF61) KeyTilde = Key(tcell.Key('~'))
KeySpace = Key(tcell.Key(' '))
// The following assignments are provided for termbox
// compatibility. Their use in applications is discouraged.
// The mouse keys are completely not supported as tcell uses
// a separate mouse event instead of key strokes.
MouseLeft = Key(tcell.KeyF63) // arbitrary assignments
MouseRight = Key(tcell.KeyF62)
MouseMiddle = Key(tcell.KeyF61)
MouseRelease = Key(tcell.KeyF60)
MouseWheelUp = Key(tcell.KeyF59)
MouseWheelDown = Key(tcell.KeyF58)
KeyCtrl2 = Key(tcell.KeyNUL) // termbox defines theses
KeyCtrl3 = Key(tcell.KeyEscape)
KeyCtrl4 = Key(tcell.KeyCtrlBackslash)
KeyCtrl5 = Key(tcell.KeyCtrlRightSq)
KeyCtrl6 = Key(tcell.KeyCtrlCarat)
KeyCtrl7 = Key(tcell.KeyCtrlUnderscore)
KeyCtrlSlash = Key(tcell.KeyCtrlUnderscore)
KeyCtrlRsqBracket = Key(tcell.KeyCtrlRightSq)
KeyCtrlBackslash = Key(tcell.KeyCtrlBackslash)
KeyCtrlLsqBracket = Key(tcell.KeyCtrlLeftSq)
) )
// Modifiers. // Modifiers.