//nolint:testpackage // white-box tests reach unexported state (approved 2026-07-07) package game // testTerm is a headless Terminal for tests: rendering is a no-op and // input plays a script, then alternates space/newline so that --More-- // and [Press return] prompts never block. type testTerm struct { input []byte pos int tick int // repaints counts forced full redraws. Rendering is a no-op here, so // counting is the only way a headless test can tell that CTRL-R asked // for a repaint rather than an ordinary refresh — the two are // indistinguishable in the window contents, which is the whole reason // the bug this replaces went unnoticed. repaints int } func (t *testTerm) Render(*Window) {} func (t *testTerm) Repaint() { t.repaints++ } func (t *testTerm) Fini() {} // Interrupt has nothing to wake: this terminal's ReadChar never blocks. // The blocking case has its own fake, blockingTerm in autosave_test.go. func (t *testTerm) Interrupt() {} func (t *testTerm) ReadChar() (byte, bool) { if t.pos < len(t.input) { c := t.input[t.pos] t.pos++ return c, true } t.tick++ if t.tick%2 == 0 { return '\n', true } return ' ', true }