Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses a persistent visual gap between the terminal container and the rendered Ghostty canvas by fitting the terminal and then distributing any remaining space as measured padding, and it adds ADR documentation for both the canvas-gap fix and a rejected file drag-and-drop path investigation.
Changes:
- Wraps
FitAddon.fit()with afit()helper that measures the actual canvas size and applies symmetric padding to eliminate the visible right/bottom gaps. - Sets the terminal container background from the configured theme to avoid a mismatched pre-render flash.
- Adds ADR 022 (accepted) documenting the canvas-gap cause/workaround and ADR 021 (rejected) documenting the file DnD path constraints; adds an
hn.mddraft.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/client/index.ts |
Replaces direct FitAddon resize handling with a measured-padding fit() wrapper and container ResizeObserver; sets container background from theme. |
docs/hn.md |
Adds a Show HN draft writeup. |
docs/adrs/022.client.canvas-fill.md |
Documents the root cause and the chosen workaround for the canvas gap, plus a proposed upstream fix. |
docs/adrs/021.client.file-drop.md |
Documents investigation and rejection rationale for file drag-and-drop path injection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Fix: terminal canvas gap (ADR 022)
ghostty-web's `FitAddon` computes terminal columns as:
```
cols = floor((containerWidth - 15px scrollbar reserve) / charWidth)
```
Two factors leave the canvas short of the container edge every time:
The fix wraps `fitAddon.fit()` to measure the actual rendered canvas width after fitting, then distributes the gap as equal padding on each side — no CSS stretching, no blurriness. Also sets `container.background` from the theme config so any pre-render flash matches the terminal colour.
Upstream fix documented in ADR 022: add `IFitAddonOptions { scrollbarWidth?: number }` to ghostty-web's `FitAddon` constructor (no option exists today).
Docs: file DnD path analysis (ADR 021)
Records the full investigation into browser file drag-and-drop path injection — all five approaches evaluated, why none was adopted cross-platform, and reference to how code-server handles the same problem.