mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +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
Notes:
sideshowbarker
2024-07-17 17:53:11 +09:00
Author: https://github.com/alimpfard
Commit: b05af48d80
Pull-request: https://github.com/SerenityOS/serenity/pull/12903
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