Fix cursor after last character in line counting as a character outside of the viewing area

The cursor column can be after the last_visible_char index and still be visible.

(cherry picked from commit 55cdaebdf9)
This commit is contained in:
MJacred 2023-09-05 19:36:17 +02:00 committed by Rémi Verschelde
parent 9f603c85e1
commit 78c0ae05db
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 1 additions and 1 deletions

View File

@ -4932,7 +4932,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);
}