mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:57:44 +00:00
LibJS: Fix off-by-one error in SyntaxHighlighter
This changes the JS syntax highlighter to conform to the now-fixed rendering of syntax highlighting spans in GUI::TextEditor.
This commit is contained in:
parent
a819f98956
commit
106ad6ba09
1 changed files with 1 additions and 2 deletions
|
@ -72,7 +72,7 @@ void SyntaxHighlighter::rehighlight(const Palette& palette)
|
|||
return;
|
||||
|
||||
start = position;
|
||||
for (size_t i = 0; i < str.length() - 1; ++i)
|
||||
for (size_t i = 0; i < str.length(); ++i)
|
||||
advance_position(str[i]);
|
||||
|
||||
GUI::TextDocumentSpan span;
|
||||
|
@ -85,7 +85,6 @@ void SyntaxHighlighter::rehighlight(const Palette& palette)
|
|||
span.is_skippable = is_trivia;
|
||||
span.data = reinterpret_cast<void*>(static_cast<size_t>(type));
|
||||
spans.append(span);
|
||||
advance_position(str[str.length() - 1]);
|
||||
|
||||
dbgln_if(SYNTAX_HIGHLIGHTING_DEBUG, "{}{} @ '{}' {}:{} - {}:{}",
|
||||
token.name(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue