fix(layout): honor DECCOLM logical widths#340
Conversation
Issue: vttest cursor movement screens drew the lower plus border shifted because Architect resized ghostty-vt back to the window-derived width immediately after DECCOLM selected 80-column mode. Solution: Preserve ghostty-vt's 80/132-column logical width when DEC mode 40 is enabled and Architect's layout target is unchanged. Reset to the computed grid or full size on real layout changes so window, font, and grid resizes still reflow normally.
There was a problem hiding this comment.
Pull request overview
This PR fixes a layout/terminal-model interaction where applications using DECCOLM (80/132-column mode) could have their ghostty-vt logical width incorrectly “corrected” back to the current tile/window target width on the next layout pass, causing cursor-movement drawing (e.g., vttest borders) to misalign.
Changes:
- Preserve ghostty-vt’s 80/132-column logical width when DECCOLM mode is active and Architect’s computed winsize target is unchanged.
- Add regression tests covering (1) preserving DECCOLM width, (2) resetting to layout width on real layout changes, and (3) correcting ordinary non-DECCOLM width drift.
- Document DECCOLM support in the README and describe the resize policy behavior in the architecture docs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/app/layout.zig | Avoids resizing the terminal model when DECCOLM is active and the PTY/layout target hasn’t changed; adds focused regression tests for the new policy. |
| README.md | Notes VT-compatible DECCOLM (80/132-column) mode handling as a supported feature. |
| docs/ARCHITECTURE.md | Documents the updated terminal resize behavior, including DECCOLM logical-width preservation and reset conditions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 82588cfdf6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Solution
vttest enables DEC mode 40, switches to 80-column DECCOLM, and then draws part of the cursor movement border by relying on cursor-forward clamping at the right edge. Architect delegated that sequence to ghostty-vt, but the next layout pass treated the 80-column model as stale and resized it back to the current tile or window width. That made the lower plus border start too far to the right.
This keeps ghostty-vt's 80/132-column logical width while Architect's own layout target is unchanged. Window, font, grid, and full/grid changes still reset the terminal to the computed size, so normal reflow behavior remains intact. The resize policy now has regression coverage for preserved DECCOLM widths, reset on a real layout change, and correction of ordinary terminal-width drift.
Test plan
+border aligns with the upper one in the 80-column pass.