diff options
author | Max Hilbrunner <mhilbrunner@users.noreply.github.com> | 2021-09-07 20:37:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-07 20:37:39 +0200 |
commit | da31873e2cc49be8e0dfc4fc4ac89c8aa4173be9 (patch) | |
tree | 8bcf8b6a878f52187de16dacc0269100aecc2deb /scene | |
parent | 06b4a48444e42e8e5587572e1d7216a38a6bc7fa (diff) | |
parent | b92347c2201832421cd4e986dff6c7824791bc2b (diff) |
Merge pull request #52359 from williamd67/fix-autocomplete-merge
Fix incorrectly removing two characters by auto brace
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/code_edit.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp index 955410f890..cb4fafa2b3 100644 --- a/scene/gui/code_edit.cpp +++ b/scene/gui/code_edit.cpp @@ -1937,7 +1937,7 @@ void CodeEdit::confirm_code_completion(bool p_replace) { if (pre_brace_pair == -1 && post_brace_pair == -1 && get_caret_column() > 0 && get_caret_column() < get_line(caret_line).length()) { pre_brace_pair = _get_auto_brace_pair_open_at_pos(caret_line, get_caret_column() + 1); - if (pre_brace_pair == _get_auto_brace_pair_close_at_pos(caret_line, get_caret_column() - 1)) { + if (pre_brace_pair != -1 && pre_brace_pair == _get_auto_brace_pair_close_at_pos(caret_line, get_caret_column() - 1)) { remove_text(caret_line, get_caret_column() - 2, caret_line, get_caret_column()); if (_get_auto_brace_pair_close_at_pos(caret_line, get_caret_column() - 1) != pre_brace_pair) { set_caret_column(get_caret_column() - 1); |