diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-09-13 21:52:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-13 21:52:38 +0200 |
commit | 0b60b9f75cfc0afea3396e19d0afb250dd61f090 (patch) | |
tree | 002c3a01d495848c0b48465c01d6a674f1f63095 /scene/gui/code_edit.cpp | |
parent | 655dec581c9e2fd8cdc62549ee0078b6fa85d6dd (diff) | |
parent | 9785167b393b019e220e7f35714f4e60ec38f4ca (diff) |
Merge pull request #52443 from Paulb23/code-edit-indext-fixes
Fix brace placement with space auto indent
Diffstat (limited to 'scene/gui/code_edit.cpp')
-rw-r--r-- | scene/gui/code_edit.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp index 2602d7476f..3beff57027 100644 --- a/scene/gui/code_edit.cpp +++ b/scene/gui/code_edit.cpp @@ -654,7 +654,7 @@ void CodeEdit::_backspace_internal() { // For space indentation we need to do a simple unindent if there are no chars to the left, acting in the // same way as tabs. if (indent_using_spaces && cc != 0) { - if (get_first_non_whitespace_column(cl) > cc) { + if (get_first_non_whitespace_column(cl) >= cc) { prev_column = cc - _calculate_spaces_till_next_left_indent(cc); prev_line = cl; } @@ -987,10 +987,10 @@ void CodeEdit::_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. */ if (p_split_current_line) { brace_indent = true; - ins += "\n" + ins.substr(1, ins.length() - 2); + ins += "\n" + ins.substr(indent_text.size(), ins.length() - 2); } else { brace_indent = false; - ins = "\n" + ins.substr(1, ins.length() - 2); + ins = "\n" + ins.substr(indent_text.size(), ins.length() - 2); } } } |