From 4ab08fb99fbc2e07382367daa5dbb5603a5e8061 Mon Sep 17 00:00:00 2001 From: Garrett Gu Date: Thu, 14 Mar 2024 00:00:16 -0500 Subject: [PATCH] Fix bug related to multicursor and backspacing with brackets --- scene/gui/code_edit.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp index f7eae2b772f7..632e6af2ce27 100644 --- a/scene/gui/code_edit.cpp +++ b/scene/gui/code_edit.cpp @@ -733,14 +733,15 @@ void CodeEdit::_backspace_internal(int p_caret) { prev_column = cc - auto_brace_completion_pairs[idx].open_key.length(); if (_get_auto_brace_pair_close_at_pos(cl, cc) == idx) { - remove_text(prev_line, prev_column, cl, cc + auto_brace_completion_pairs[idx].close_key.length()); - } else { - remove_text(prev_line, prev_column, cl, cc); + cc += auto_brace_completion_pairs[idx].close_key.length(); } + + remove_text(prev_line, prev_column, cl, cc); + set_caret_line(prev_line, false, true, 0, i); set_caret_column(prev_column, i == 0, i); - adjust_carets_after_edit(i, prev_line, prev_column, cl, cc + auto_brace_completion_pairs[idx].close_key.length()); + adjust_carets_after_edit(i, prev_line, prev_column, cl, cc); continue; } }