summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-03-11 16:06:00 +0100
committerGitHub <noreply@github.com>2022-03-11 16:06:00 +0100
commit3f3826edb8a3b5ea137dbe5a167e3b9336181551 (patch)
tree43f561f8b08e67519d4df332cd14e8f6d550d623
parente56b69269f80ef8af133a0c5d54c66caecba9622 (diff)
parent4b8fa3716f384064382fc0c7cb7bb91fde1626e0 (diff)
Merge pull request #59007 from novaplusplus/code_edit_from_to_error_fix
-rw-r--r--scene/gui/text_edit.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 05fda7128c..3c80e3f987 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -4469,7 +4469,11 @@ int TextEdit::get_visible_line_count() const {
int TextEdit::get_visible_line_count_in_range(int p_from_line, int p_to_line) const {
ERR_FAIL_INDEX_V(p_from_line, text.size(), 0);
ERR_FAIL_INDEX_V(p_to_line, text.size(), 0);
- ERR_FAIL_COND_V(p_from_line > p_to_line, 0);
+
+ // So we can handle inputs in whatever order
+ if (p_from_line > p_to_line) {
+ SWAP(p_from_line, p_to_line);
+ }
/* Returns the total number of (lines + wrapped - hidden). */
if (!_is_hiding_enabled() && get_line_wrapping_mode() == LineWrappingMode::LINE_WRAPPING_NONE) {