Calling Application.Draw() for global key handlers which steal the event.

This commit is contained in:
Oliver 2018-01-12 17:37:47 +01:00
parent 0c4fd605ae
commit fdab2627c3
1 changed files with 3 additions and 1 deletions

View File

@ -46,7 +46,7 @@ func NewApplication() *Application {
// The handler receives the Primitive to which the key is originally redirected,
// the one which has focus, or nil if it was not directed to a Primitive. The
// handler also returns whether or not the key event is then forwarded to that
// Primitive.
// Primitive. Draw() is called implicitly if the event is not forwarded.
//
// Special keys (e.g. Escape, Enter, or Ctrl-A) are defined by the "key"
// argument. The "ch" rune is ignored. Other keys (e.g. "a", "h", or "5") are
@ -134,6 +134,7 @@ func (a *Application) Run() error {
if event.Key() == tcell.KeyRune {
if handler, ok := a.runeOverrides[event.Rune()]; ok {
if !handler(p) {
a.Draw()
break
}
}
@ -144,6 +145,7 @@ func (a *Application) Run() error {
pr = nil
}
if !handler(pr) {
a.Draw()
break
}
}