Repository navigation
feat(client): tighter fit, configurable padding, and edge extension - #42
Merged
Merged
Conversation
…tension The client no longer uses FitAddon, which always reserved a fixed 15px for a scrollbar and left a visible strip at the edges. The grid is now sized from the full container (ADR 033). - New top-level `padding` config (px, default 0): the gap at the top and left is exactly `padding`; the sub-cell leftover goes to the right and bottom (ADR 034). - New optional `theme.padding` colour for the space `padding` adds; defaults to `theme.background` and is not sent to the terminal. - The leftover strip takes the edge cells' own background, by repainting the canvas' last pixel row and column across it, like Ghostty's `window-padding-color = extend` (ADR 035). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Font remeasurement can leave edge-strip geometry stale, and some documentation still describes superseded padding behavior.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (3)
What changed in this PR
Replaces FitAddon with full-container grid sizing, adds configurable padding, and extends terminal edge colours into leftover space.
Changes:
- Adds validated
paddingconfiguration and API exposure. - Introduces grid/inset calculations and edge-extension rendering.
- Adds unit tests, specifications, and ADRs.
| File | Description |
|---|---|
src/server/routes.ts |
Exposes padding to clients. |
src/server/routes.test.ts |
Tests padding API output. |
src/config.ts |
Defines and parses padding settings. |
src/config.test.ts |
Tests padding and theme parsing. |
src/client/index.ts |
Integrates fitting, padding, and edge extension. |
src/client/fit.ts |
Calculates grid dimensions and insets. |
src/client/fit.test.ts |
Tests fitting calculations. |
src/client/edge.ts |
Implements edge-colour extension. |
src/client/edge.test.ts |
Tests edge-strip geometry. |
docs/specs/config.md |
Documents padding configuration. |
docs/specs/client.md |
Updates client behavior specification. |
docs/adrs/035.client.edge-extend.md |
Records edge-extension decision. |
docs/adrs/034.client.padding-config.md |
Records padding configuration decision. |
docs/adrs/033.client.padding-fit.md |
Records custom fitting decision. |
docs/adrs/022.client.canvas-fill.md |
Links the superseding fit ADR. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…with edge extension - document.fonts.ready remeasures the font, which changes the cell size, but the grid and the edge strips were only recomputed on resize. Schedule a fit after remeasuring so both follow the new metrics. - ADR 034 and the client SPEC still described theme.padding colouring the sub-cell leftover; since ADR 035 the leftover is filled from the edge cells and theme.padding colours only the space `padding` adds. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Removes the visible strip around the terminal canvas and adds a way to ask for padding.
FitAddon, which always reserves a fixed 15px for a scrollbar even though ghostty-web draws its scrollbar as an overlay inside the canvas. A smallcomputeGrid()(src/client/fit.ts) sizes the grid from the full container, so the strip at the edges shrinks from ~16px to under one cell. This is the local version of the upstream fix already documented in ADR 022.padding(px, default0). The top and left gaps are exactlypadding; the sub-cell leftover goes to the right and bottom, like most terminal emulators. New optionaltheme.paddingcolours the spacepaddingadds (defaults totheme.background, not sent to the terminal).window-padding-color = extend). Always on, no setting. Stretching rows to fill the height was rejected because fractional row heights give seams and blur.Existing configs render as before, apart from a slightly larger grid (up to one column wider, since the reserve is gone).
Why
Full-screen TUIs that paint their own edge cells, such as a multiplexer with a darker sidebar, showed a band of the default background between the browser chrome and the app. Only
theme.backgroundwas available to colour it, and it is also the terminal's default cell colour.Notes
computeGrid,computeInsets(fit.ts) andcomputeEdgeRects(edge.ts). The DOM part of edge extension has no unit test.paddingis added to the/api/configwhitelist and to the config parser (negative or non-numeric values fall back to0).Test plan
bun run lintcleanbun test: 419 pass, 0 fail"padding": 8in~/.config/webtty/config.jsonand confirm 8px gaps on the top and left🤖 Generated with Claude Code