Enable ESCKey binding

Permit the binding of the ESCKey correctly. The default setup is the
same (inputMode := termbox.InputAlt) if user doesn't set the
InputESC value explictly.
This commit is contained in:
Gustavo Bittencourt 2016-08-28 00:29:12 -03:00
parent aa556cf135
commit 873bc2c17d
1 changed files with 7 additions and 0 deletions

7
gui.go
View File

@ -51,6 +51,10 @@ type Gui struct {
// If Mouse is true then mouse events will be enabled.
Mouse bool
// If InputEsc is true, when an ESC sequence in the buffer that doesn't
// match any known sequence, the ESC means KeyEsc.
InputEsc bool
// Editor allows to define the editor that manages the edition mode,
// including keybindings or cursor behaviour. DefaultEditor is used by
// default.
@ -257,6 +261,9 @@ func (g *Gui) MainLoop() error {
}()
inputMode := termbox.InputAlt
if g.InputEsc {
inputMode = termbox.InputEsc
}
if g.Mouse {
inputMode |= termbox.InputMouse
}