Summary
When the terminal is resized, the opencode TUI re-layouts on grow but not on
shrink, and not on the initial attach. The drawn width stays at its previous
value, so the TUI either leaves blank space or overflows the terminal.
Measured in a browser-hosted terminal (xterm.js over a WebSocket PTY, opencode
1.18.16):
| terminal columns |
columns opencode actually draws |
result |
| 100 (initial) |
78 |
under-fills — blank space on the right |
| 119 (grown) |
117 |
correct, follows the resize |
| 68 (shrunk) |
117 |
stale — overflows the terminal |
The resize does reach the process
This is not a missing-notification problem. The chain was verified layer by layer:
- the terminal element resizes
- xterm.js recomputes its grid (26 -> 15 -> 31 rows)
- the frontend sends the new size over the WebSocket:
{"type":"resize","data":{"cols":68,"rows":27}}
- the PTY receives it and delivers SIGWINCH — a plain
bash on the same host over
the same transport re-wraps correctly, so the signal is being delivered
Only the last step fails: opencode receives the new size and re-layouts on grow, but
keeps the old width on shrink and on the initial draw.
Workaround
Forcing a redraw inside the TUI (e.g. Ctrl+L) restores the correct layout, which is
consistent with "the size is known, but no re-layout is scheduled".
Environment
- opencode-ai 1.18.16 (release notes for 1.18.17 and 1.18.18 contain no
resize-related changes, so this is likely still present)
- Linux x86_64; the terminal is xterm.js in a browser, over a WebSocket PTY bridge
- Reproduces on every attach; not specific to a model or provider
Summary
When the terminal is resized, the opencode TUI re-layouts on grow but not on
shrink, and not on the initial attach. The drawn width stays at its previous
value, so the TUI either leaves blank space or overflows the terminal.
Measured in a browser-hosted terminal (xterm.js over a WebSocket PTY, opencode
1.18.16):
The resize does reach the process
This is not a missing-notification problem. The chain was verified layer by layer:
{"type":"resize","data":{"cols":68,"rows":27}}bashon the same host overthe same transport re-wraps correctly, so the signal is being delivered
Only the last step fails: opencode receives the new size and re-layouts on grow, but
keeps the old width on shrink and on the initial draw.
Workaround
Forcing a redraw inside the TUI (e.g.
Ctrl+L) restores the correct layout, which isconsistent with "the size is known, but no re-layout is scheduled".
Environment
resize-related changes, so this is likely still present)