func makeEvent(tev tcell.Event) Event { switch tev := tev.(type) { case *tcell.EventInterrupt: return Event{Type: EventInterrupt} case *tcell.EventResize: w, h := tev.Size() return Event{Type: EventResize, Width: w, Height: h} case *tcell.EventKey: k := tev.Key() ch := rune(0) if k == tcell.KeyRune { ch = tev.Rune() if ch == ' ' { k = tcell.Key(' ') } } mod := tev.Modifiers() return Event{ Type: EventKey, Key: Key(k), Ch: ch, Mod: Modifier(mod), } default: return Event{Type: EventNone} } }