mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
HackStudio: Don't use an OOB TextRange when looking for hovered text
We could going +1 past the end of a TextDocumentLine here. This caused us to crash in the brave new world, so we could find it. :^)
This commit is contained in:
parent
4b202a3c79
commit
a1e7aa330c
Notes:
sideshowbarker
2024-07-19 06:29:08 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/a1e7aa330cf
1 changed files with 2 additions and 1 deletions
|
@ -234,7 +234,8 @@ void Editor::mousemove_event(GUI::MouseEvent& event)
|
|||
|
||||
if (span.range.contains(text_position)) {
|
||||
auto adjusted_range = span.range;
|
||||
adjusted_range.end().set_column(adjusted_range.end().column() + 1);
|
||||
auto end_line_length = document().line(span.range.end().line()).length();
|
||||
adjusted_range.end().set_column(min(end_line_length, adjusted_range.end().column() + 1));
|
||||
auto hovered_span_text = document().text_in_range(adjusted_range);
|
||||
#ifdef EDITOR_DEBUG
|
||||
dbg() << "Hovering: " << adjusted_range << " \"" << hovered_span_text << "\"";
|
||||
|
|
Loading…
Reference in a new issue