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
@ -282,6 +282,7 @@ const (
KeyCtrlX = Key(tcell.KeyCtrlX) KeyCtrlX = Key(tcell.KeyCtrlX)
KeyCtrlY = Key(tcell.KeyCtrlY) KeyCtrlY = Key(tcell.KeyCtrlY)
KeyCtrlZ = Key(tcell.KeyCtrlZ) KeyCtrlZ = Key(tcell.KeyCtrlZ)
KeyCtrlUnderscore = Key(tcell.KeyCtrlUnderscore)
KeyBackspace = Key(tcell.KeyBackspace) KeyBackspace = Key(tcell.KeyBackspace)
KeyBackspace2 = Key(tcell.KeyBackspace2) KeyBackspace2 = Key(tcell.KeyBackspace2)
KeyTab = Key(tcell.KeyTab) KeyTab = Key(tcell.KeyTab)
@ -289,10 +290,29 @@ const (
KeyEsc = Key(tcell.KeyEscape) KeyEsc = Key(tcell.KeyEscape)
KeyPgdn = Key(tcell.KeyPgDn) KeyPgdn = Key(tcell.KeyPgDn)
KeyPgup = Key(tcell.KeyPgUp) KeyPgup = Key(tcell.KeyPgUp)
KeySpace = Key(tcell.Key(' '))
KeyTilde = 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 MouseLeft = Key(tcell.KeyF63) // arbitrary assignments
MouseRight = Key(tcell.KeyF62) MouseRight = Key(tcell.KeyF62)
MouseMiddle = Key(tcell.KeyF61) MouseMiddle = Key(tcell.KeyF61)
KeySpace = Key(tcell.Key(' ')) 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.