mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Fix adjacent link edge case
This commit is contained in:
+1
-1
@@ -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║');
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user