Merge pull request #81352 from MJacred/3.x

[3.x] Fix cursor after last character INDEX in line counting as a character outside of the viewing area
This commit is contained in:
Rémi Verschelde 2023-09-18 11:36:12 +02:00
commit d6c2a4bf68
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -4950,7 +4950,7 @@ Rect2 TextEdit::get_rect_at_line_column(int p_line, int p_column) const {
int first_visible_char = cache_entry.first_visible_char[wrap_index];
int last_visible_char = cache_entry.last_visible_char[wrap_index];
if (p_column < first_visible_char || p_column > last_visible_char) {
if (p_column < first_visible_char || p_column > (last_visible_char + 1)) {
// Character is outside of the viewing area, no point calculating its position.
return Rect2i(-1, -1, 0, 0);
}