summaryrefslogtreecommitdiff
path: root/tools/editor/code_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/code_editor.cpp')
-rw-r--r--tools/editor/code_editor.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp
index ed7a46d70d..d2bf070f1b 100644
--- a/tools/editor/code_editor.cpp
+++ b/tools/editor/code_editor.cpp
@@ -188,7 +188,9 @@ void FindReplaceBar::_replace_all() {
text_edit->cursor_set_line(0);
text_edit->cursor_set_column(0);
+ String replace_text=get_replace_text();
int search_text_len=get_search_text().length();
+
int rc=0;
replace_all_mode = true;
@@ -204,7 +206,7 @@ void FindReplaceBar::_replace_all() {
if (match_from < prev_match)
break; // done
- prev_match=match_to;
+ prev_match=Point2i(result_line,result_col+replace_text.length());
text_edit->select(result_line,result_col,result_line,match_to.y);
@@ -214,12 +216,12 @@ void FindReplaceBar::_replace_all() {
continue;
// replace but adjust selection bounds
- text_edit->insert_text_at_cursor(get_replace_text());
+ text_edit->insert_text_at_cursor(replace_text);
if (match_to.x==selection_end.x)
- selection_end.y+=get_replace_text().length() - get_search_text().length();
+ selection_end.y+=replace_text.length()-search_text_len;
} else {
// just replace
- text_edit->insert_text_at_cursor(get_replace_text());
+ text_edit->insert_text_at_cursor(replace_text);
}
rc++;