defer PTY spawn until first TerminalView resize
test / unit + widget + golden + a11y (push) Failing after 1m57s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped

The PTY was spawning at 80x24 defaults before TerminalView had laid
out, then the real resize caused visual artifacts (ghost lines, broken
reflow). Now spawn triggers on the first onResize callback when real
dimensions are known — matching the pty-spike's proven pattern.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jeroen Schweitzer
2026-05-01 09:24:10 +02:00
co-authored by Claude Opus 4.6
parent 6d180a876a
commit 6f12c884cd
2 changed files with 11 additions and 2 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
{
"exported_at": "2026-04-30T20:42:24Z",
"exported_at": "2026-05-01T07:24:10Z",
"decisions": [
{
"id": "D-1",
+10 -1
View File
@@ -52,12 +52,15 @@ class _ClaudePaneState extends State<ClaudePane> {
String _statusLine = 'attaching…';
@override
bool _spawned = false;
void initState() {
super.initState();
_terminal = Terminal(maxLines: _maxLines);
_terminal.onOutput = _onOutput;
_terminal.onResize = _onResize;
WidgetsBinding.instance.addPostFrameCallback((_) => _spawnWhenReady());
// Don't spawn here — wait for the first onResize from TerminalView
// so the PTY gets real dimensions, not 80x24 defaults.
}
@override
@@ -201,6 +204,12 @@ class _ClaudePaneState extends State<ClaudePane> {
}
void _onResize(int cols, int rows, int _, int __) {
if (!_spawned) {
// First resize — TerminalView has real dimensions now.
_spawned = true;
_spawnWhenReady();
return;
}
final id = _paneId;
if (id == null) return;
_ipc()?.request('pane.resize', args: {'id': id, 'cols': cols, 'rows': rows});