diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-04-06 11:28:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-06 11:28:42 +0200 |
commit | e14464caebedfd24e5c425d7118981123f8055a5 (patch) | |
tree | db8da46e4612ed303ba79caf1cd0420179968c00 | |
parent | 32d9d6e7ff93fd584f00479a5ffad1d0829ad643 (diff) | |
parent | 2144eb05df52de32c5f78c749c4c1193e6d09a0a (diff) |
Merge pull request #37447 from ThakeeNathees/text-replace-empty-string-fix
replace selected text with empty string bug fixed
-rw-r--r-- | editor/code_editor.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 157a9cdca7..77e20b971c 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -226,6 +226,10 @@ void FindReplaceBar::_replace_all() { text_edit->begin_complex_operation(); + if (selection_enabled && is_selection_only()) { + text_edit->cursor_set_line(selection_begin.width); + text_edit->cursor_set_column(selection_begin.height); + } if (search_current()) { do { // replace area @@ -243,7 +247,7 @@ void FindReplaceBar::_replace_all() { if (selection_enabled && is_selection_only()) { if (match_from < selection_begin || match_to > selection_end) { - continue; + break; // Done. } // Replace but adjust selection bounds. @@ -289,6 +293,10 @@ void FindReplaceBar::_get_search_from(int &r_line, int &r_col) { r_line = text_edit->cursor_get_line(); r_col = text_edit->cursor_get_column(); + if (text_edit->is_selection_active() && is_selection_only()) { + return; + } + if (r_line == result_line && r_col >= result_col && r_col <= result_col + get_search_text().length()) { r_col = result_col; } |