mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 20:45:14 +00:00
sql: Account for the single quotes in syntax highlighting
Previously, a String literal token like 'hello' had every char highlighted but for the last 'o' and the closing single quote. This is because the token start is at the opening single quote but the `length` variable only accounted for the value length without the single quotes.
This commit is contained in:
parent
0e5b2c923d
commit
aca87ce146
Notes:
sideshowbarker
2024-07-18 03:04:21 +09:00
Author: https://github.com/i3abghany Commit: https://github.com/SerenityOS/serenity/commit/aca87ce1462 Pull-request: https://github.com/SerenityOS/serenity/pull/10091 Issue: https://github.com/SerenityOS/serenity/issues/10028 Reviewed-by: https://github.com/JanDeVisser Reviewed-by: https://github.com/davidot ✅ Reviewed-by: https://github.com/trflynn89
1 changed files with 1 additions and 2 deletions
|
@ -112,9 +112,8 @@ int main()
|
|||
|
||||
bool indenters_starting_line = true;
|
||||
for (SQL::AST::Token token = lexer.next(); token.type() != SQL::AST::TokenType::Eof; token = lexer.next()) {
|
||||
auto length = token.value().length();
|
||||
auto start = token.start_position().column - 1;
|
||||
auto end = start + length;
|
||||
auto end = token.end_position().column - 1;
|
||||
|
||||
if (indenters_starting_line) {
|
||||
if (token.type() != SQL::AST::TokenType::ParenClose)
|
||||
|
|
Loading…
Add table
Reference in a new issue