提交 4af6a58a 编写于 作者: A Alex Dima

Fixes #18616: Inline decorations ending at the text length are no longer rendered

上级 6446eb22
......@@ -476,7 +476,7 @@ function _applyInlineDecorations(lineContent: string, len: number, tokens: ViewL
result[resultLen++] = new ViewLineToken(lastResultEndIndex, tokenType);
}
if (lineDecoration.endOffset + 1 < tokenEndIndex) {
if (lineDecoration.endOffset + 1 <= tokenEndIndex) {
lastResultEndIndex = lineDecoration.endOffset + 1;
result[resultLen++] = new ViewLineToken(lastResultEndIndex, tokenType + ' ' + lineDecoration.className);
lineDecorationIndex++;
......
......@@ -72,6 +72,32 @@ suite('Editor ViewLayout - ViewLineParts', () => {
assert.deepEqual(actual.output.split(/></g), expected.split(/></g));
}
test('issue #18616: Inline decorations ending at the text length are no longer rendered', () => {
let lineContent = 'https://microsoft.com';
let actual = renderViewLine(new RenderLineInput(
lineContent,
false,
0,
[new ViewLineToken(21, 'mtk3')],
[new Decoration(1, 22, 'link', false)],
4,
10,
-1,
'none',
false
));
let expected = [
'<span>',
'<span class="mtk3 link">https://microsoft.com</span>',
'</span>'
].join('');
assert.deepEqual(actual.output, expected);
});
test('createLineParts simple', () => {
testCreateLineParts(
'Hello world!',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册