mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
TextEditor: Stopped disappearing text at end of document (#505)
text_position_at() was returning -1 if the position wasn't in the bounds of a visual line. Now if the position is past the last line, we simply return the last line index instead of -1. Fixes #502.
This commit is contained in:
parent
3e2e086011
commit
3e6a0a0533
Notes:
sideshowbarker
2024-07-19 12:25:56 +09:00
Author: https://github.com/RyanGrieb
Commit: 3e6a0a0533
Pull-request: https://github.com/SerenityOS/serenity/pull/505
1 changed files with 2 additions and 1 deletions
|
@ -139,7 +139,8 @@ GTextPosition GTextEditor::text_position_at(const Point& a_position) const
|
|||
if (position.y() >= rect.top() && position.y() <= rect.bottom()) {
|
||||
line_index = i;
|
||||
break;
|
||||
}
|
||||
} else if (position.y() > rect.bottom())
|
||||
line_index = m_lines.size() - 1;
|
||||
}
|
||||
} else {
|
||||
line_index = position.y() / line_height();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue