mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +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
Notes:
sideshowbarker
2024-07-18 16:53:28 +09:00
Author: https://github.com/MaxWipfli Commit: https://github.com/SerenityOS/serenity/commit/106ad6ba094 Pull-request: https://github.com/SerenityOS/serenity/pull/7768 Issue: https://github.com/SerenityOS/serenity/issues/7349 Reviewed-by: https://github.com/alimpfard
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…
Reference in a new issue