From 3ed6ce8f670caf023bf510f6c7b3592e472d3b27 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 17 Jul 2026 13:55:34 +0200 Subject: [PATCH] Add test showing that resuming after a suspend schedules no redraw When lazygit is suspended with ctrl+z and brought back with fg, nothing deliberately triggers a redraw. The screen only repaints because the UI thread happens to have a flush pending from the suspend keybinding, and that flush races the SIGCONT handler's resume; when it loses in the right way, the terminal shows a blank screen until the next input event arrives (#5309). --- pkg/gocui/suspend_test.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 pkg/gocui/suspend_test.go diff --git a/pkg/gocui/suspend_test.go b/pkg/gocui/suspend_test.go new file mode 100644 index 000000000..25a15c921 --- /dev/null +++ b/pkg/gocui/suspend_test.go @@ -0,0 +1,27 @@ +package gocui + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +func TestResumeSchedulesRedraw(t *testing.T) { + g := newTestGui(t) + + assert.NoError(t, g.Suspend()) + assert.NoError(t, g.Resume()) + + ev := GocuiEvent{Type: eventNone} + select { + case ev = <-g.gEvents: + 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) +}