Fix adjacent link edge case

This commit is contained in:
Daniel Imms
2022-08-07 07:42:21 -07:00
parent d9b8c6a838
commit c39d235168
2 changed files with 11 additions and 4 deletions
+1 -1
View File
@@ -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║');
+10 -3
View File
@@ -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);
}
}