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

pull/29/head
Oliver 7 years ago
parent 0c4fd605ae
commit fdab2627c3

@ -46,7 +46,7 @@ func NewApplication() *Application {
// The handler receives the Primitive to which the key is originally redirected, // 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 // 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 // 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" // 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 // 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 event.Key() == tcell.KeyRune {
if handler, ok := a.runeOverrides[event.Rune()]; ok { if handler, ok := a.runeOverrides[event.Rune()]; ok {
if !handler(p) { if !handler(p) {
a.Draw()
break break
} }
} }
@ -144,6 +145,7 @@ func (a *Application) Run() error {
pr = nil pr = nil
} }
if !handler(pr) { if !handler(pr) {
a.Draw()
break break
} }
} }

Loading…
Cancel
Save