Skip to content

Commit

Permalink
Handling tcell.ErrorEvent now. Fixes #617
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver committed Jun 24, 2021
1 parent 5f84306 commit 36f5c19
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions application.go
Expand Up @@ -212,7 +212,7 @@ func (a *Application) EnableMouse(enable bool) *Application {
// when Stop() was called.
func (a *Application) Run() error {
var (
err error
err, appErr error
lastRedraw time.Time // The time the screen was last redrawn.
redrawTimer *time.Timer // A timer to schedule the next redraw.
)
Expand Down Expand Up @@ -326,6 +326,7 @@ EventLoop:
// Ctrl-C closes the application.
if event.Key() == tcell.KeyCtrlC {
a.Stop()
break
}

// Pass other key events to the root primitive.
Expand Down Expand Up @@ -369,6 +370,9 @@ EventLoop:
if isMouseDownAction {
a.mouseDownX, a.mouseDownY = event.Position()
}
case *tcell.EventError:
appErr = event
a.Stop()
}

// If we have updates, now is the time to execute them.
Expand All @@ -384,7 +388,7 @@ EventLoop:
wg.Wait()
a.screen = nil

return nil
return appErr
}

// fireMouseActions analyzes the provided mouse event, derives mouse actions
Expand Down

0 comments on commit 36f5c19

Please sign in to comment.