pass -x/-y to tmux new-session for correct initial size
test / unit + widget + golden + a11y (push) Failing after 27s
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

tmux running inside a PTY without a traditional terminal client
defaults to a huge window size (2000+ cols, 10000 rows). Pass
explicit -x and -y flags matching the TerminalView dimensions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jeroen Schweitzer
2026-05-01 13:03:51 +02:00
co-authored by Claude Opus 4.6
parent 0b3c6bc1f8
commit a028eb7ad3
3 changed files with 12 additions and 4 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
{
"exported_at": "2026-05-01T10:20:03Z",
"exported_at": "2026-05-01T11:03:51Z",
"decisions": [
{
"id": "D-1",
+9
View File
@@ -124,13 +124,20 @@ class _ClaudePaneState extends State<ClaudePane> {
: secondarySessionName(repoRoot, widget.secondaryIndex!);
// tmux-wrapped session for persistence (D-041).
// -x/-y set the initial window size; without them tmux defaults
// to a huge size when running inside a PTY without a real terminal.
final cols = _terminal.viewWidth;
final rows = _terminal.viewHeight;
var argv = <String>[
'tmux',
'new-session',
'-A',
'-s',
sessionName,
'-x', '$cols',
'-y', '$rows',
];
print('[spawn] cols=${_terminal.viewWidth} rows=${_terminal.viewHeight}');
var resp = await ipc.request('pane.spawn', args: {
'argv': argv,
'kind': PaneKind.claude.wire,
@@ -222,6 +229,7 @@ class _ClaudePaneState extends State<ClaudePane> {
Timer? _resizeTimer;
void _onResize(int cols, int rows, int _, int __) {
print('[onResize] cols=$cols rows=$rows spawned=$_spawned paneId=$_paneId');
if (!_spawned) {
// First resize — TerminalView has real dimensions now.
_spawned = true;
@@ -234,6 +242,7 @@ class _ClaudePaneState extends State<ClaudePane> {
_resizeTimer = Timer(const Duration(milliseconds: 150), () {
final id = _paneId;
if (id == null) return;
print('[resize] cols=$cols rows=$rows');
_ipc()?.request('pane.resize', args: {'id': id, 'cols': cols, 'rows': rows});
});
}
+2 -3
View File
@@ -276,11 +276,10 @@ class NativePty {
final ws = calloc<_Winsize>()
..ref.wsRow = rows
..ref.wsCol = cols;
_ioctl(_fd, _kTiocsWinsz, ws);
final rc = _ioctl(_fd, _kTiocsWinsz, ws);
calloc.free(ws);
print('[pty-resize] fd=$_fd cols=$cols rows=$rows ioctl=$rc pid=$pid');
// Explicitly signal the child to re-query its terminal size.
// macOS should auto-send SIGWINCH on TIOCSWINSZ, but the legacy
// Python implementation sent it explicitly for reliability.
_nativeKill(pid, 28); // SIGWINCH = 28 on macOS/Linux
}