mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 22:48: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
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