diff --git a/src/vs/base/common/charCode.ts b/src/vs/base/common/charCode.ts index 3b8c64267106eaa912bbc9e1f2f9d521aa838bbe..23b840b294200a6767e0371658e2478588d7d1a1 100644 --- a/src/vs/base/common/charCode.ts +++ b/src/vs/base/common/charCode.ts @@ -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 +} diff --git a/src/vs/editor/browser/view/domLineBreaksComputer.ts b/src/vs/editor/browser/view/domLineBreaksComputer.ts index 81611253b0158086f33fffce44861ca6d71cf9e6..45c568d0715f2ccf6e265d0455d2c1be914b2480 100644 --- a/src/vs/editor/browser/view/domLineBreaksComputer.ts +++ b/src/vs/editor/browser/view/domLineBreaksComputer.ts @@ -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; diff --git a/src/vs/editor/common/modes/textToHtmlTokenizer.ts b/src/vs/editor/common/modes/textToHtmlTokenizer.ts index c8c4acac43090c8d1d2209023747312d541def64..dd64e79ded6835011a63f749a2ef11bc76bae124 100644 --- a/src/vs/editor/common/modes/textToHtmlTokenizer.ts +++ b/src/vs/editor/common/modes/textToHtmlTokenizer.ts @@ -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; diff --git a/src/vs/editor/common/viewLayout/viewLineRenderer.ts b/src/vs/editor/common/viewLayout/viewLineRenderer.ts index c698400c1834c6f4704459788e57d453f7915e9b..3ff97b83674d3924f2f16fd3ac2474e21b66e0ba 100644 --- a/src/vs/editor/common/viewLayout/viewLineRenderer.ts +++ b/src/vs/editor/common/viewLayout/viewLineRenderer.ts @@ -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; diff --git a/src/vs/editor/test/common/viewLayout/viewLineRenderer.test.ts b/src/vs/editor/test/common/viewLayout/viewLineRenderer.test.ts index 7124aba04e5730d1e1a79ccebcfd70e5074528ee..1147b17c2051a7433607fba37b88911c3c7e6282 100644 --- a/src/vs/editor/test/common/viewLayout/viewLineRenderer.test.ts +++ b/src/vs/editor/test/common/viewLayout/viewLineRenderer.test.ts @@ -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 = [ + 'var\u00a0ftext\u00a0=\u00a0[\uFFFD"Und",\u00a0"dann",\u00a0"eines"];' + ]; + 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, '' + expectedOutput.join('') + ''); + }); + test('issue #19673: Monokai Theme bad-highlighting in line wrap', () => { let lineText = ' MongoCallback): void {';