Merge pull request #46627 from jmb462/fix-incorrect-autoindentation-in-multiline-brackets

Fix incorrect auto-indentation in multiline brackets (fix #46384)
This commit is contained in:
Rémi Verschelde 2021-03-07 16:55:32 +01:00 committed by GitHub
commit dc2207d8e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}
}
}
}