1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:37:46 +00:00

LibSQL: Fix off-by-one error in SyntaxHighlighter

This changes the SQL SyntaxHighlighter to conform to the now-fixed
rendering of syntax highlighting spans in GUI::TextEditor.
This commit is contained in:
Max Wipfli 2021-06-04 11:04:16 +02:00 committed by Ali Mohammad Pur
parent a9378ce5c2
commit 04897f6842

View file

@ -52,8 +52,8 @@ void SyntaxHighlighter::rehighlight(Palette const& palette)
return; return;
GUI::TextPosition position { token.line_number() - 1, token.line_column() - 1 }; GUI::TextPosition position { token.line_number() - 1, token.line_column() - 1 };
for (size_t i = 0; i < str.length() - 1; ++i) { for (char c : str) {
if (str[i] == '\n') { if (c == '\n') {
position.set_line(position.line() + 1); position.set_line(position.line() + 1);
position.set_column(0); position.set_column(0);
} else } else