apps/gophers: simplify type switch

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-07-12 15:41:10 +02:00
parent 1336ca109a
commit 759fdb2efe
+1 -3
View File
@@ -198,8 +198,7 @@ func (a *App) run() error {
a.w.Redraw() a.w.Redraw()
case e := <-a.w.Events(): case e := <-a.w.Events():
switch e := e.(type) { switch e := e.(type) {
case input.Event: case key.ChordEvent:
if e, ok := e.(key.ChordEvent); ok {
switch e.Name { switch e.Name {
case key.NameEscape: case key.NameEscape:
os.Exit(0) os.Exit(0)
@@ -209,7 +208,6 @@ func (a *App) run() error {
a.w.Redraw() a.w.Redraw()
} }
} }
}
case app.StageEvent: case app.StageEvent:
if e.Stage >= app.StageRunning { if e.Stage >= app.StageRunning {
if a.ctxCancel == nil { if a.ctxCancel == nil {