From 519d0647fda95c695cb54125c6e96241de06149b Mon Sep 17 00:00:00 2001 From: MJacred Date: Tue, 5 Sep 2023 19:36:17 +0200 Subject: [PATCH] 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. --- scene/gui/text_edit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index ee496b4df..b694a2e42 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -4838,7 +4838,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); }