diff --git a/demo/client.ts b/demo/client.ts index cfebf384..507663a8 100644 --- a/demo/client.ts +++ b/demo/client.ts @@ -834,7 +834,7 @@ function addAnsiHyperlink() { term.writeln('\x1b]8;;https://github.com\x07GitHub\x1b]8;;\x07'); term.writeln('\x1b]8;;https://xtermjs.org\x07https://xtermjs.org\x1b]8;;\x07\x1b[C<- null cell'); term.writeln(`\nAdjacent links:`); - term.writeln('\x1b]8;;https://github.com\x07GitHub\x1b]8;;https://xtermjs.org\x07xterm.js\x1b]8;;\x07'); + term.writeln('\x1b]8;;https://github.com\x07GitHub\x1b]8;;https://xtermjs.org\x07\x1b[32mxterm.js\x1b[0m\x1b]8;;\x07'); term.writeln(`\nShared ID link (underline should be shared):`); term.writeln('╔════╗'); term.writeln('║\x1b]8;id=testid;https://github.com\x07GitH\x1b]8;;\x07║'); diff --git a/src/browser/OscLinkProvider.ts b/src/browser/OscLinkProvider.ts index 96a2c395..8d3977c6 100644 --- a/src/browser/OscLinkProvider.ts +++ b/src/browser/OscLinkProvider.ts @@ -65,7 +65,6 @@ export class OscLinkProvider implements ILinkProvider { // These ranges are 1-based range: { start: { - // TODO: Adjacent links aren't working correctly x: currentStart + 1, y }, @@ -80,12 +79,20 @@ export class OscLinkProvider implements ILinkProvider { leave: linkHandler?.leave }); } - currentStart = -1; - currentLinkId = -1; finishLink = false; + + // Clear link or start a new link if one starts immediately + if (cell.hasExtendedAttrs() && cell.extended.urlId) { + currentStart = x; + currentLinkId = cell.extended.urlId; + } else { + currentStart = -1; + currentLinkId = -1; + } } } // TODO: Handle fetching and returning other link ranges to underline other links with the same id + console.log('result', result); callback(result); } }