未验证 提交 94428f89 编写于 作者: A Alex Dima

Fixes #95685: Use Unicode replacement character for all unusual line terminators

上级 7a424f60
......@@ -342,7 +342,17 @@ export const enum CharCode {
* Unicode Character 'LINE SEPARATOR' (U+2028)
* http://www.fileformat.info/info/unicode/char/2028/index.htm
*/
LINE_SEPARATOR_2028 = 8232,
LINE_SEPARATOR = 0x2028,
/**
* Unicode Character 'PARAGRAPH SEPARATOR' (U+2029)
* http://www.fileformat.info/info/unicode/char/2029/index.htm
*/
PARAGRAPH_SEPARATOR = 0x2029,
/**
* Unicode Character 'NEXT LINE' (U+0085)
* http://www.fileformat.info/info/unicode/char/0085/index.htm
*/
NEXT_LINE = 0x0085,
// http://www.fileformat.info/info/unicode/category/Sk/list.htm
U_CIRCUMFLEX = 0x005E, // U+005E CIRCUMFLEX
......@@ -422,4 +432,4 @@ export const enum CharCode {
* http://www.fileformat.info/info/unicode/char/feff/index.htm
*/
UTF8_BOM = 65279
}
\ No newline at end of file
}
......@@ -217,7 +217,9 @@ function renderLine(lineContent: string, initialVisibleColumn: number, tabSize:
break;
case CharCode.UTF8_BOM:
case CharCode.LINE_SEPARATOR_2028:
case CharCode.LINE_SEPARATOR:
case CharCode.PARAGRAPH_SEPARATOR:
case CharCode.NEXT_LINE:
sb.write1(0xFFFD);
break;
......
......@@ -68,7 +68,9 @@ export function tokenizeLineToHTML(text: string, viewLineTokens: IViewLineTokens
break;
case CharCode.UTF8_BOM:
case CharCode.LINE_SEPARATOR_2028:
case CharCode.LINE_SEPARATOR:
case CharCode.PARAGRAPH_SEPARATOR:
case CharCode.NEXT_LINE:
partContent += '\ufffd';
break;
......
......@@ -934,7 +934,9 @@ function _renderLine(input: ResolvedRenderLineInput, sb: IStringBuilder): Render
break;
case CharCode.UTF8_BOM:
case CharCode.LINE_SEPARATOR_2028:
case CharCode.LINE_SEPARATOR:
case CharCode.PARAGRAPH_SEPARATOR:
case CharCode.NEXT_LINE:
sb.write1(0xFFFD);
break;
......
......@@ -703,6 +703,36 @@ suite('viewLineRenderer.renderLine', () => {
assert.equal(actual.containsRTL, true);
});
test('issue #95685: Uses unicode replacement character for Paragraph Separator', () => {
const lineText = 'var ftext = [\u2029"Und", "dann", "eines"];';
const lineParts = createViewLineTokens([createPart(lineText.length, 1)]);
const expectedOutput = [
'<span class="mtk1">var\u00a0ftext\u00a0=\u00a0[\uFFFD"Und",\u00a0"dann",\u00a0"eines"];</span>'
];
const actual = renderViewLine(new RenderLineInput(
false,
true,
lineText,
false,
false,
false,
0,
lineParts,
[],
4,
0,
10,
10,
10,
-1,
'none',
false,
false,
null
));
assert.equal(actual.html, '<span>' + expectedOutput.join('') + '</span>');
});
test('issue #19673: Monokai Theme bad-highlighting in line wrap', () => {
let lineText = ' MongoCallback<string>): void {';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册