mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-04 18:23:39 +00:00
LibWeb: Fix highlighting HTML comments
Commit b193351a99
caused the HTML comments to flash when changing
the text cursor. Also, when double-clicking on a comment, the selection
started from the beginning of the file instead.
The following message was displaying when `TOKENIZER_TRACE_DEBUG`
was enabled:
(Tokenizer::nth_last_position) Invalid position requested: 4th-last
of 4. Returning (0-0).
Changing the `nth_last_position` to 3 fixes this. I'm guessing that's
because the parser is at that moment on the second hyphen of the `<!--`
string, so it has to go back only by three characters.
This commit is contained in:
parent
704bb361bb
commit
fb5e2670d6
Notes:
sideshowbarker
2024-07-17 18:52:44 +09:00
Author: https://github.com/krkk
Commit: fb5e2670d6
Pull-request: https://github.com/SerenityOS/serenity/pull/12505
Reviewed-by: https://github.com/linusg ✅
2 changed files with 2 additions and 2 deletions
|
@ -382,7 +382,7 @@ _StartOfFunction:
|
|||
DONT_CONSUME_NEXT_INPUT_CHARACTER;
|
||||
if (consume_next_if_match("--")) {
|
||||
create_new_token(HTMLToken::Type::Comment);
|
||||
m_current_token.set_start_position({}, nth_last_position(4));
|
||||
m_current_token.set_start_position({}, nth_last_position(3));
|
||||
SWITCH_TO(CommentStart);
|
||||
}
|
||||
if (consume_next_if_match("DOCTYPE", CaseSensitivity::CaseInsensitive)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue