summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmb462 <jmb462@gmail.com>2021-03-03 18:59:59 +0100
committerjmb462 <jmb462@gmail.com>2021-03-03 18:59:59 +0100
commitf05d6f66b00d22e38ceb4e419e12606a25ed819a (patch)
tree7d1101d6ab1d13de5dd9ac861f8266f32b840d27
parent4d1f83a621a03a42a6ab7765084db84aab32256f (diff)
fix incorrect iauto-indentation in mutliline bracket (fix #46384)
-rw-r--r--scene/gui/text_edit.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 36aa18417d..c2f5ec78c3 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2199,9 +2199,14 @@ void TextEdit::_new_line(bool p_split_current_line, bool p_above) {
// No need to move the brace below if we are not taking the text with us.
char32_t closing_char = _get_right_pair_symbol(indent_char);
- if ((closing_char != 0) && (closing_char == text[cursor.line][cursor.column]) && !p_split_current_line) {
- brace_indent = true;
- ins += "\n" + ins.substr(1, ins.length() - 2);
+ if ((closing_char != 0) && (closing_char == text[cursor.line][cursor.column])) {
+ if (p_split_current_line) {
+ brace_indent = true;
+ ins += "\n" + ins.substr(1, ins.length() - 2);
+ } else {
+ brace_indent = false;
+ ins = "\n" + ins.substr(1, ins.length() - 2);
+ }
}
}
}