mirror of
https://github.com/rivo/tview.git
synced 2025-05-05 19:30:02 +08:00
Handling tcell.ErrorEvent now. Fixes #617
This commit is contained in:
parent
5f84306246
commit
36f5c190ea
@ -212,7 +212,7 @@ func (a *Application) EnableMouse(enable bool) *Application {
|
|||||||
// when Stop() was called.
|
// when Stop() was called.
|
||||||
func (a *Application) Run() error {
|
func (a *Application) Run() error {
|
||||||
var (
|
var (
|
||||||
err error
|
err, appErr error
|
||||||
lastRedraw time.Time // The time the screen was last redrawn.
|
lastRedraw time.Time // The time the screen was last redrawn.
|
||||||
redrawTimer *time.Timer // A timer to schedule the next redraw.
|
redrawTimer *time.Timer // A timer to schedule the next redraw.
|
||||||
)
|
)
|
||||||
@ -326,6 +326,7 @@ EventLoop:
|
|||||||
// Ctrl-C closes the application.
|
// Ctrl-C closes the application.
|
||||||
if event.Key() == tcell.KeyCtrlC {
|
if event.Key() == tcell.KeyCtrlC {
|
||||||
a.Stop()
|
a.Stop()
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass other key events to the root primitive.
|
// Pass other key events to the root primitive.
|
||||||
@ -369,6 +370,9 @@ EventLoop:
|
|||||||
if isMouseDownAction {
|
if isMouseDownAction {
|
||||||
a.mouseDownX, a.mouseDownY = event.Position()
|
a.mouseDownX, a.mouseDownY = event.Position()
|
||||||
}
|
}
|
||||||
|
case *tcell.EventError:
|
||||||
|
appErr = event
|
||||||
|
a.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have updates, now is the time to execute them.
|
// If we have updates, now is the time to execute them.
|
||||||
@ -384,7 +388,7 @@ EventLoop:
|
|||||||
wg.Wait()
|
wg.Wait()
|
||||||
a.screen = nil
|
a.screen = nil
|
||||||
|
|
||||||
return nil
|
return appErr
|
||||||
}
|
}
|
||||||
|
|
||||||
// fireMouseActions analyzes the provided mouse event, derives mouse actions
|
// fireMouseActions analyzes the provided mouse event, derives mouse actions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user