summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-09-17 22:33:08 +0200
committerGitHub <noreply@github.com>2017-09-17 22:33:08 +0200
commite4dd65b6fbb64b7114cfe99adef87ac19d9cde46 (patch)
tree364e636f959ff2d5c949a7898e407db479a4b588
parent259778ce8c861cc6f9e3ffa528cdabc06f2dfa39 (diff)
parent31ba932e3bf7b3ad7ab6ef559fbdb3656d7afe86 (diff)
Merge pull request #11370 from marcelofg55/fix_keyu_crashnew
Fix crash when using key+u on a line with only a #
-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 db6d257640..2ca4c81319 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2804,8 +2804,12 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
_remove_text(i, 0, i, 1);
}
} else {
- if (get_line(cursor.line).begins_with("#"))
+ if (get_line(cursor.line).begins_with("#")) {
_remove_text(cursor.line, 0, cursor.line, 1);
+ if (cursor.column >= get_line(cursor.line).length()) {
+ cursor.column = MAX(0, get_line(cursor.line).length() - 1);
+ }
+ }
}
update();
}