summaryrefslogtreecommitdiff
path: root/scene/gui/code_edit.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-10-06 16:25:17 +0200
committerGitHub <noreply@github.com>2021-10-06 16:25:17 +0200
commit010e17b44f7560afac61e40522279d9cac5a78a7 (patch)
tree7e3e536e4ebecb56bc823eb53a77e16f2fed0b2a /scene/gui/code_edit.cpp
parent294acad796f72e3d1507c60959695a215081dbd1 (diff)
parent0caab00d66efcdf69b9529d7368ce9e260d03b9c (diff)
Merge pull request #53476 from Paulb23/breakpoint-move-up-fix
Diffstat (limited to 'scene/gui/code_edit.cpp')
-rw-r--r--scene/gui/code_edit.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index 46ec7b4d3d..da54903871 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -2937,6 +2937,7 @@ void CodeEdit::_lines_edited_from(int p_from_line, int p_to_line) {
return;
}
+ lines_edited_changed += p_to_line - p_from_line;
lines_edited_from = (lines_edited_from == -1) ? MIN(p_from_line, p_to_line) : MIN(lines_edited_from, MIN(p_from_line, p_to_line));
lines_edited_to = (lines_edited_to == -1) ? MAX(p_from_line, p_to_line) : MAX(lines_edited_from, MAX(p_from_line, p_to_line));
}
@@ -2963,7 +2964,6 @@ void CodeEdit::_text_changed() {
}
lc = get_line_count();
- int line_change_size = (lines_edited_to - lines_edited_from);
List<int> breakpoints;
breakpointed_lines.get_key_list(&breakpoints);
for (const int &line : breakpoints) {
@@ -2974,8 +2974,8 @@ void CodeEdit::_text_changed() {
breakpointed_lines.erase(line);
emit_signal(SNAME("breakpoint_toggled"), line);
- int next_line = line + line_change_size;
- if (next_line < lc && is_line_breakpointed(next_line)) {
+ int next_line = line + lines_edited_changed;
+ if (next_line > -1 && next_line < lc && is_line_breakpointed(next_line)) {
emit_signal(SNAME("breakpoint_toggled"), next_line);
breakpointed_lines[next_line] = true;
continue;
@@ -2984,6 +2984,7 @@ void CodeEdit::_text_changed() {
lines_edited_from = -1;
lines_edited_to = -1;
+ lines_edited_changed = 0;
}
CodeEdit::CodeEdit() {