diff options
author | qarmin <mikrutrafal54@gmail.com> | 2019-06-20 17:13:16 +0200 |
---|---|---|
committer | qarmin <mikrutrafal54@gmail.com> | 2019-06-20 17:13:16 +0200 |
commit | 532a7ba06a0233879bbce61b2b268291e811df50 (patch) | |
tree | 06e90a636d1ab29a52d7a57c9bcdce5f827a52ed /scene/gui | |
parent | 197b65f32ac811f79bc5599fbfe8cf83914b6873 (diff) |
Fix TextEdit Select
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/text_edit.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 6203b15992..28beefbfe5 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -4825,14 +4825,18 @@ void TextEdit::deselect() { void TextEdit::select(int p_from_line, int p_from_column, int p_to_line, int p_to_column) { - if (p_from_line >= text.size()) + if (p_from_line < 0) + p_from_line = 0; + else if (p_from_line >= text.size()) p_from_line = text.size() - 1; if (p_from_column >= text[p_from_line].length()) p_from_column = text[p_from_line].length(); if (p_from_column < 0) p_from_column = 0; - if (p_to_line >= text.size()) + if (p_to_line < 0) + p_to_line = 0; + else if (p_to_line >= text.size()) p_to_line = text.size() - 1; if (p_to_column >= text[p_to_line].length()) p_to_column = text[p_to_line].length(); |