mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-17 22:00:59 +01:00
Fixes issue #19207: Link in Monokai is not rendered correctly
This commit is contained in:
@@ -495,10 +495,14 @@ function _applyInlineDecorations(lineContent: string, len: number, tokens: ViewL
|
||||
}
|
||||
|
||||
if (lineDecoration.endOffset + 1 <= tokenEndIndex) {
|
||||
// This line decoration ends before this token ends
|
||||
lastResultEndIndex = lineDecoration.endOffset + 1;
|
||||
result[resultLen++] = new ViewLineToken(lastResultEndIndex, tokenType + ' ' + lineDecoration.className);
|
||||
lineDecorationIndex++;
|
||||
} else {
|
||||
// This line decoration continues on to the next token
|
||||
lastResultEndIndex = tokenEndIndex;
|
||||
result[resultLen++] = new ViewLineToken(lastResultEndIndex, tokenType + ' ' + lineDecoration.className);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +100,47 @@ suite('Editor ViewLayout - ViewLineParts', () => {
|
||||
assert.deepEqual(actual.output, expected);
|
||||
});
|
||||
|
||||
test('issue #19207: Link in Monokai is not rendered correctly', () => {
|
||||
|
||||
let lineContent = '\'let url = `http://***/_api/web/lists/GetByTitle(\\\'Teambuildingaanvragen\\\')/items`;\'';
|
||||
|
||||
let actual = renderViewLine(new RenderLineInput(
|
||||
true,
|
||||
lineContent,
|
||||
false,
|
||||
0,
|
||||
[
|
||||
new ViewLineToken(49, 'mtk6'),
|
||||
new ViewLineToken(51, 'mtk4'),
|
||||
new ViewLineToken(72, 'mtk6'),
|
||||
new ViewLineToken(74, 'mtk4'),
|
||||
new ViewLineToken(84, 'mtk6'),
|
||||
],
|
||||
[
|
||||
new Decoration(13, 51, 'detected-link', false)
|
||||
],
|
||||
4,
|
||||
10,
|
||||
-1,
|
||||
'none',
|
||||
false
|
||||
));
|
||||
|
||||
let expected = [
|
||||
'<span>',
|
||||
'<span class="mtk6">\'let url = `</span>',
|
||||
'<span class="mtk6 detected-link">http://***/_api/web/lists/GetByTitle(</span>',
|
||||
'<span class="mtk4 detected-link">\\</span>',
|
||||
'<span class="mtk4">\'</span>',
|
||||
'<span class="mtk6">Teambuildingaanvragen</span>',
|
||||
'<span class="mtk4">\\\'</span>',
|
||||
'<span class="mtk6">)/items`;\'</span>',
|
||||
'</span>'
|
||||
].join('');
|
||||
|
||||
assert.deepEqual(actual.output, expected);
|
||||
});
|
||||
|
||||
test('createLineParts simple', () => {
|
||||
testCreateLineParts(
|
||||
false,
|
||||
|
||||
Reference in New Issue
Block a user