From aca87ce1462fad7c6d19fbffa316280d759da47a Mon Sep 17 00:00:00 2001 From: Mahmoud Mandour Date: Sat, 18 Sep 2021 17:38:29 +0200 Subject: [PATCH] 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. --- Userland/Utilities/sql.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Userland/Utilities/sql.cpp b/Userland/Utilities/sql.cpp index e79189bfac2..510fddd0289 100644 --- a/Userland/Utilities/sql.cpp +++ b/Userland/Utilities/sql.cpp @@ -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)