mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-19 12:49:32 +01:00
feat(terminal): link URLs and paths that wrap across rows or sit in table cells
A CLI that word-wraps inside a markdown table cell or an indented paragraph
breaks a long URL or path short of the right edge and indents the rest, so
nothing is flagged isWrapped and no row is full width. Each row linked only
a fragment, and the fragment opened the wrong target.
- findTerminalUrls() (constants.js) is the URL grammar for the link provider:
a ")" that closes a "(" inside the URL is kept, an unmatched one still ends
it, so (https://...) and [text](https://...) stay clean.
- terminalUrlContinuationExtent() joins rows the CLI wrapped a URL across,
only when the fragment ends on a wrap-break character, the next row is
indented no further right than the URL started, and its first token looks
like URL material. Table columns after the first fragment are left out.
- terminalLinkLine() widens terminalPathLine() to that extent; a URL that
spans rows is emitted as one link per row, each opening the whole URL, so
the indent and other columns between the pieces are not underlined.
- terminalCellWrappedPaths() follows an absolute path down its own table
cell (space-separated or box-drawn), so two-column tables link both paths.
- A full-width table divider no longer counts as a hard-wrapped line.
- OSC 8 hyperlinks open through the same opener, web URLs only.
This commit is contained in:
1 parent
002de32a08
commit
9f62da9ac3
6 files changed
+1018
-83
No files matched your search
@@ -299,7 +299,10 @@ describe('openLinkThroughWebTabIfLoopback', () => {
|
||||
|
||||
describe('callers consult the hook first', () => {
|
||||
it('terminal URL links try the web tab before window.open', () => {
|
||||
const activate = TERMINAL_UI.indexOf('activate(_event, text) {');
|
||||
// URL links (and OSC 8 links) open through _openTerminalUrl(), so the desktop
|
||||
// click and the mobile touch-tap path both consult the hook. Read that function.
|
||||
expect(TERMINAL_UI).toContain('self._openTerminalUrl(url);');
|
||||
const activate = TERMINAL_UI.indexOf('_openTerminalUrl(text) {');
|
||||
expect(activate).toBeGreaterThan(-1);
|
||||
const body = TERMINAL_UI.slice(activate, TERMINAL_UI.indexOf('},', activate));
|
||||
expect(body.indexOf('openLinkThroughWebTabIfLoopback?.(text)')).toBeGreaterThan(-1);
|
||||
|
||||
Reference in new issue
Block a user