Extract the tcell-to-gocui event conversion out of pollEvent

A following commit needs pollEvent to attach information from the
replayed-event wrappers to the GocuiEvent it returns. With the
conversion inlined there is no seam to do that in, because every branch
of the type switch returns directly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Stefan Haller 2026-07-15 14:32:48 +02:00
parent 4fea011021
commit 7e1073a0ee

View file

@ -300,6 +300,10 @@ func (g *Gui) pollEvent() GocuiEvent {
tev = <-Screen.EventQ()
}
return gocuiEventFromTcellEvent(tev)
}
func gocuiEventFromTcellEvent(tev tcell.Event) GocuiEvent {
switch tev := tev.(type) {
case *tcell.EventInterrupt:
return GocuiEvent{Type: eventInterrupt}