Schedule a redraw when resuming from suspension

Until now the repaint after fg was accidental: it only happened because
the suspend keybinding handler still had a flush pending on the UI
thread, and only if that flush happened to run after the SIGCONT
handler had re-engaged the screen. Now that flushes are skipped while
suspended, losing that race would leave the screen blank until the next
input event arrives, so schedule a redraw explicitly (#5309).
This commit is contained in:
Stefan Haller 2026-07-17 14:00:06 +02:00
parent d887a41ad2
commit 319f43e166
2 changed files with 5 additions and 3 deletions

View file

@ -1976,6 +1976,11 @@ func (g *Gui) Resume() error {
g.suspended = false
// Schedule a redraw of the whole screen. Nothing else guarantees one:
// flushes are skipped while suspended, and after re-engaging the screen
// the terminal shows nothing until we draw again.
go func() { g.gEvents <- GocuiEvent{Type: eventResize} }()
return nil
}

View file

@ -64,9 +64,6 @@ func TestResumeSchedulesRedraw(t *testing.T) {
case <-time.After(100 * time.Millisecond):
}
/* EXPECTED:
assert.Equal(t, eventResize, ev.Type,
"resuming must schedule a redraw; without one the screen stays blank until the next event arrives")
ACTUAL: */
assert.Equal(t, eventNone, ev.Type)
}