fix(web): preserve terminal links across wide cells - #10815
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The core link/offset logic changes are cohesive and well-covered by targeted unit tests, with only a minor test-fixture realism suggestion.
Pull request overview
This PR improves the Ghostty terminal surface’s link reconstruction and hit-testing so URLs/paths remain contiguous and correctly highlighted across wide-cell spacer tails (CJK/emoji) and soft-wrapped spacer heads.
Changes:
- Treat
spacerTailandspacerHeadcells as zero-width when reconstructing terminal row text for link extraction. - Update column↔text-offset mapping so link ranges include trailing spacer tails when appropriate (e.g., wide emoji at the end of a link).
- Add regression tests covering CJK, emoji, real blanks, and soft-wrapped links.
File summaries
| File | Description |
|---|---|
| apps/web/src/terminal/ghostty/surface.ts | Adjusts text reconstruction and offset/column mapping to preserve link detection across wide/spacer cells and wraps. |
| apps/web/src/terminal/ghostty/surface.test.ts | Adds regression tests for spacer-tail/head behavior across URLs/paths, emoji, and wrapped rows. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| text: cells | ||
| .map( | ||
| (value) => | ||
| value.text || | ||
| (value.wide === GHOSTTY_CELL_WIDE.spacerTail || value.wide === GHOSTTY_CELL_WIDE.spacerHead | ||
| ? "" | ||
| : " "), | ||
| ) | ||
| .join("") | ||
| .trimEnd(), |
There was a problem hiding this comment.
Fixed in 8a6437d. rowFromCells.text now matches GhosttyTerminalCore exactly (cell.text || " "), while the production link reconstruction continues to derive text from the cell data and spacer flags.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe terminal now treats wide-cell spacer heads and tails as part of the same visual character during text extraction and link-range mapping. Tests cover URLs, paths, trailing emoji, wrapped rows, and soft-wrap spacer heads. ChangesWide-cell link resolution
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to Terminal link detection and highlight ranges now correctly span wide characters and soft-wrapped rows. The targeted unit coverage passes, with no concrete merge-blocking risk identified. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
8a6437d to
56bb01e
Compare
|
@StiensWout When you have time, could you review this small bug fix? It preserves terminal links across CJK/emoji wide cells and wrapped rows. Tests and browser verification are complete. No rush though. |
Summary
Validation
pnpm --filter @t3tools/web exec vp test run src/terminal/ghostty/surface.test.ts --project unitpnpm --filter @t3tools/web typecheckSummary by CodeRabbit