diff options
author | Paulb23 <p_batty@hotmail.co.uk> | 2021-09-06 17:10:39 +0100 |
---|---|---|
committer | Paulb23 <p_batty@hotmail.co.uk> | 2021-09-06 17:10:39 +0100 |
commit | 9785167b393b019e220e7f35714f4e60ec38f4ca (patch) | |
tree | b3c40b500d8a66e99d7a093406abdae07827fbd8 /scene | |
parent | 29a3300c6aaa2c7915c39ad633dc3b0ce0a8505b (diff) |
Fix brace placement with space auto indent
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/code_edit.cpp | 6 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp index 5f3ab18cca..ca884f56e4 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); } } } diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 7e64c13b37..e5ba12ec8d 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2517,10 +2517,10 @@ void TextEdit::set_text(const String &p_text) { set_caret_column(0); begin_complex_operation(); + deselect(); _remove_text(0, 0, MAX(0, get_line_count() - 1), MAX(get_line(MAX(get_line_count() - 1, 0)).size() - 1, 0)); insert_text_at_caret(p_text); end_complex_operation(); - selection.active = false; } set_caret_line(0); |