Merge pull request #91779 from kitbdev/select-next-replace
Select next text to replace
This commit is contained in:
commit
7724a50c28
1 changed files with 3 additions and 3 deletions
|
@ -199,6 +199,7 @@ bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col)
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindReplaceBar::_replace() {
|
void FindReplaceBar::_replace() {
|
||||||
|
text_editor->begin_complex_operation();
|
||||||
text_editor->remove_secondary_carets();
|
text_editor->remove_secondary_carets();
|
||||||
bool selection_enabled = text_editor->has_selection(0);
|
bool selection_enabled = text_editor->has_selection(0);
|
||||||
Point2i selection_begin, selection_end;
|
Point2i selection_begin, selection_end;
|
||||||
|
@ -210,7 +211,6 @@ void FindReplaceBar::_replace() {
|
||||||
String repl_text = get_replace_text();
|
String repl_text = get_replace_text();
|
||||||
int search_text_len = get_search_text().length();
|
int search_text_len = get_search_text().length();
|
||||||
|
|
||||||
text_editor->begin_complex_operation();
|
|
||||||
if (selection_enabled && is_selection_only()) {
|
if (selection_enabled && is_selection_only()) {
|
||||||
// Restrict search_current() to selected region.
|
// Restrict search_current() to selected region.
|
||||||
text_editor->set_caret_line(selection_begin.width, false, true, -1, 0);
|
text_editor->set_caret_line(selection_begin.width, false, true, -1, 0);
|
||||||
|
@ -249,6 +249,7 @@ void FindReplaceBar::_replace() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindReplaceBar::_replace_all() {
|
void FindReplaceBar::_replace_all() {
|
||||||
|
text_editor->begin_complex_operation();
|
||||||
text_editor->remove_secondary_carets();
|
text_editor->remove_secondary_carets();
|
||||||
text_editor->disconnect("text_changed", callable_mp(this, &FindReplaceBar::_editor_text_changed));
|
text_editor->disconnect("text_changed", callable_mp(this, &FindReplaceBar::_editor_text_changed));
|
||||||
// Line as x so it gets priority in comparison, column as y.
|
// Line as x so it gets priority in comparison, column as y.
|
||||||
|
@ -279,8 +280,6 @@ void FindReplaceBar::_replace_all() {
|
||||||
|
|
||||||
replace_all_mode = true;
|
replace_all_mode = true;
|
||||||
|
|
||||||
text_editor->begin_complex_operation();
|
|
||||||
|
|
||||||
if (selection_enabled && is_selection_only()) {
|
if (selection_enabled && is_selection_only()) {
|
||||||
text_editor->set_caret_line(selection_begin.width, false, true, -1, 0);
|
text_editor->set_caret_line(selection_begin.width, false, true, -1, 0);
|
||||||
text_editor->set_caret_column(selection_begin.height, true, 0);
|
text_editor->set_caret_column(selection_begin.height, true, 0);
|
||||||
|
@ -619,6 +618,7 @@ void FindReplaceBar::_replace_text_submitted(const String &p_text) {
|
||||||
search_prev();
|
search_prev();
|
||||||
} else {
|
} else {
|
||||||
_replace();
|
_replace();
|
||||||
|
search_next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue