diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-03-07 16:55:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-07 16:55:32 +0100 |
commit | dc2207d8e8602a518ca1019c15d1994c1e8f36d6 (patch) | |
tree | 08f579fe3c4200f9945a0893757259880a3f8aa9 | |
parent | daab4c9ac4b7fc0ed4ff51b4fb0e39b612b870cc (diff) | |
parent | f05d6f66b00d22e38ceb4e419e12606a25ed819a (diff) |
Merge pull request #46627 from jmb462/fix-incorrect-autoindentation-in-multiline-brackets
Fix incorrect auto-indentation in multiline brackets (fix #46384)
-rw-r--r-- | scene/gui/text_edit.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 5a7901c11b..d1d9e18126 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2190,9 +2190,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); + } } } } |