diff --git a/Userland/Libraries/LibCpp/SyntaxHighlighter.cpp b/Userland/Libraries/LibCpp/SyntaxHighlighter.cpp index aae1e81bc6..563fe1db76 100644 --- a/Userland/Libraries/LibCpp/SyntaxHighlighter.cpp +++ b/Userland/Libraries/LibCpp/SyntaxHighlighter.cpp @@ -63,10 +63,11 @@ void SyntaxHighlighter::rehighlight(Palette const& palette) Vector spans; for (auto& token : tokens) { - dbgln_if(SYNTAX_HIGHLIGHTING_DEBUG, "{} @ {}:{} - {}:{}", token.type_as_string(), token.start().line, token.start().column, token.end().line, token.end().column); + // FIXME: The +1 for the token end column is a quick hack due to not wanting to modify the lexer (which is also used by the parser). Maybe there's a better way to do this. + dbgln_if(SYNTAX_HIGHLIGHTING_DEBUG, "{} @ {}:{} - {}:{}", token.type_as_string(), token.start().line, token.start().column, token.end().line, token.end().column + 1); GUI::TextDocumentSpan span; span.range.set_start({ token.start().line, token.start().column }); - span.range.set_end({ token.end().line, token.end().column }); + span.range.set_end({ token.end().line, token.end().column + 1 }); auto style = style_for_token_type(palette, token.type()); span.attributes.color = style.color; span.attributes.bold = style.bold;