Repository navigation
fix(terminal): stop gluing the next line onto a modifier-clicked URL - #9100
Conversation
Path hard-wrap reconstruction (from #8339) joins a URL ending mid-row with the next line's path-like prefix, so Cmd-click opened https://…/orca/Description instead of https://…/orca/ (#8832). File links were protected by existence checks; HTTP links were not. Stop feeding path hard-wrap candidates into HTTP hit-testing. Reconstruct edge-wrapped HTTP URLs only when earlier rows reach the terminal edge (with label-row guards and length-derived scan bounds), and keep native soft-wrap plus framed TUI hard-wrap HTTP candidates. Based on work by @xianjianlf2 in #8852. Fixes #8832 Co-authored-by: MarkXian <mark-xian@foxmail.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds fallback reconstruction for HTTP(S) URLs spanning terminal edges when wrap metadata is unavailable. The hit-testing pipeline now includes these candidates alongside hard-wrapped candidates. New tests cover wide glyphs, multi-row and length-limited URLs, label and path boundaries, adjacent-line non-gluing, file URLs, Windows paths, and URL activation with or without native wrap metadata. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/components/terminal-pane/edge-wrapped-terminal-http-links.test.ts (1)
403-424: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExercise the over-limit URL branch.
Current URLs top out at 2,040 characters, so none tests crossing the 2,048-character cutoff. Add exact-limit and limit-plus-one cases, including protection against opening a truncated prefix.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 8b078eab-e09c-481b-952d-ce889967916d
📒 Files selected for processing (5)
src/renderer/src/components/terminal-pane/edge-wrapped-terminal-http-links.test.tssrc/renderer/src/components/terminal-pane/edge-wrapped-terminal-http-links.tssrc/renderer/src/components/terminal-pane/repro-8832-url-next-line.test.tssrc/renderer/src/components/terminal-pane/terminal-url-link-click.test.tssrc/renderer/src/components/terminal-pane/terminal-url-link-hit-testing.ts
Final review (ready to merge)Correctness
/perf
CI / mergeability
Merging and closing superseded #8852 (credit retained for @xianjianlf2). |
…tablyai#9100) Fixes stablyai#8832. HTTP hit-testing no longer consumes path hard-wrap candidates that poisoned mid-row URLs with next-line labels. Uses soft-wrap, framed hard-wrap HTTP, and dedicated edge-wrap reconstruction instead. Supersedes stablyai#8852 (edge-wrap approach credit: @xianjianlf2).
Summary
Fixes #8832.
Takes over / combines the best of #8852 (@xianjianlf2): stop path hard-wrap candidates from poisoning HTTP hit-testing, and reconstruct genuine edge-wrapped HTTP URLs safely.
Cmd-clicking a URL that ends mid-row opened it with the first word of the next line appended:
opened
https://github.com/stablyai/orca/Descriptioninstead ofhttps://github.com/stablyai/orca/.Root cause
findHttpLinkAtBufferPositionbuilt logical lines from soft-wrap, framed hard-wrap HTTP, and path hard-wrap reconstruction (buildCandidateLogicalLinesForBufferPosition/ #8339).Path hard-wrap treats a URL suffix ending in
/as a path start and joins the next row's path-like prefix (Description:). HTTP extraction then trims trailing:→…/orca/Description. File links never showed this because they verify path existence; HTTP links had no equivalent check.Fix
HTTP hit-testing no longer consumes path hard-wrap candidates. It uses only:
isWrapped) — long terminal-wrapped URLsbuildEdgeWrappedHttpLogicalLineCandidates) — join without wrap metadata only when each earlier row reaches the terminal edge (one-cell wide-glyph tolerance), with label-row / adjacent-scheme guards and a row scan bound derived fromTERMINAL_HTTP_URL_MAX_LENGTHCredit: core approach and edge-wrap reconstruction from @xianjianlf2 in #8852 (including the length-derived row bound). This PR takes that over with a permanent #8832 regression suite and adversarial coverage.
Evidence
Results: 170 files / 2176 tests passed (focused: repro 12, edge-wrap 18, click 13).
Covered cases:
Description:next line) → unglued URLDescription:,HTTP/2: 200, etc.)file://is not treated as HTTPELI5
When you Cmd/Ctrl-click a web link in the terminal, Orca sometimes “stitched” the next line onto it because a helper meant for file paths was also used for web links. We stopped using that file-path helper for web links. Real long links that wrap at the screen edge still work; random labels on the next line no longer get glued on.
User-regression-tradeoffs
Description:)isWrapped)Supersedes: #8852 (please close in favor of this PR once reviewed).