mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-16 02:26:24 -04:00
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).
This commit is contained in:
parent
b371411567
commit
3ed6ce8f67
27
pkg/gocui/suspend_test.go
Normal file
27
pkg/gocui/suspend_test.go
Normal file
|
|
@ -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)
|
||||
}
|
||||
Loading…
Reference in a new issue