mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:38:10 +00:00
GTextEditor: Fix text_position_at() behavior when passed negative values.
This commit is contained in:
parent
35c6dceee0
commit
6d172725c0
1 changed files with 2 additions and 2 deletions
|
@ -100,8 +100,8 @@ GTextPosition GTextEditor::text_position_at(const Point& a_position) const
|
|||
position.move_by(-(padding() + ruler_width()), -padding());
|
||||
int line_index = position.y() / line_height();
|
||||
int column_index = position.x() / glyph_width();
|
||||
line_index = min(line_index, line_count() - 1);
|
||||
column_index = min(column_index, m_lines[line_index]->length());
|
||||
line_index = max(0, min(line_index, line_count() - 1));
|
||||
column_index = max(0, min(column_index, m_lines[line_index]->length()));
|
||||
return { line_index, column_index };
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue