1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:47:44 +00:00

LibJS: Correctly handle Unicode characters in JS source text

Also recognize additional white space characters.
This commit is contained in:
davidot 2021-08-14 17:07:47 +02:00 committed by Linus Groh
parent 4d6502de42
commit 47bc72bcf6
6 changed files with 100 additions and 16 deletions

View file

@ -120,8 +120,8 @@ public:
String source_string { source };
source_string.replace("\r\n", "\n");
source_string.replace("\r", "\n");
source_string.replace(LINE_SEPARATOR, "\n");
source_string.replace(PARAGRAPH_SEPARATOR, "\n");
source_string.replace(LINE_SEPARATOR_STRING, "\n");
source_string.replace(PARAGRAPH_SEPARATOR_STRING, "\n");
StringBuilder builder;
builder.append(source_string.split_view('\n', true)[position.value().line - 1]);
builder.append('\n');