mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 23:27:42 +00:00
js: Use token offset for highlighting instead of column offset
This makes it work correctly with multiline inputs as well.
This commit is contained in:
parent
287f33165e
commit
b05af48d80
1 changed files with 1 additions and 1 deletions
|
@ -1451,7 +1451,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool indenters_starting_line = true;
|
||||
for (JS::Token token = lexer.next(); token.type() != JS::TokenType::Eof; token = lexer.next()) {
|
||||
auto length = Utf8View { token.value() }.length();
|
||||
auto start = token.line_column() - 1;
|
||||
auto start = token.offset();
|
||||
auto end = start + length;
|
||||
if (indenters_starting_line) {
|
||||
if (token.type() != JS::TokenType::ParenClose && token.type() != JS::TokenType::BracketClose && token.type() != JS::TokenType::CurlyClose) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue