Fix TUI rendering with wrong dimensions after suspend/resume

- Send SIGWINCH to self on terminal start to refresh stale dimensions (Unix only)
- Change requestRender(true) to set previousWidth = -1 to trigger widthChanged
- Update first render condition to skip when widthChanged is true

Fixes #599
This commit is contained in:
Mario Zechner 2026-01-11 02:47:28 +01:00
parent 019ad0ec11
commit d7394eb109
3 changed files with 13 additions and 3 deletions

View file

@ -70,6 +70,12 @@ export class ProcessTerminal implements Terminal {
// Set up resize handler immediately
process.stdout.on("resize", this.resizeHandler);
// Refresh terminal dimensions - they may be stale after suspend/resume
// (SIGWINCH is lost while process is stopped). Unix only.
if (process.platform !== "win32") {
process.kill(process.pid, "SIGWINCH");
}
// Query and enable Kitty keyboard protocol
// The query handler intercepts input temporarily, then installs the user's handler
// See: https://sw.kovidgoyal.net/kitty/keyboard-protocol/