anomalyco / anomalyco/opencode
TUI does not re-layout on terminal shrink (only on grow), leaving stale width
@kommander is already working on this.
Since Aug 13, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
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
bashon 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.