search: Improve performance of replace_all
(#13654)
Previously replace_all amounted to what could be achieved by repeatedly mashing "Replace" button, which had a bunch of overhead related to buffer state syncing. This commit gets rid of the automated button mashing, processing all of the replacements in one go. Fixes #13455 Release Notes: - Improved performance of "replace all" in buffer search and project search
This commit is contained in:
parent
b616f9c27f
commit
0761383752
4 changed files with 58 additions and 6 deletions
|
@ -1122,9 +1122,7 @@ impl BufferSearchBar {
|
|||
.as_ref()
|
||||
.clone()
|
||||
.with_replacement(self.replacement(cx));
|
||||
for m in matches {
|
||||
searchable_item.replace(m, &query, cx);
|
||||
}
|
||||
searchable_item.replace_all(&mut matches.iter(), &query, cx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -591,9 +591,7 @@ impl ProjectSearchView {
|
|||
}
|
||||
|
||||
self.results_editor.update(cx, |editor, cx| {
|
||||
for item in &match_ranges {
|
||||
editor.replace(item, &query, cx);
|
||||
}
|
||||
editor.replace_all(&mut match_ranges.iter(), &query, cx);
|
||||
});
|
||||
|
||||
self.model.update(cx, |model, _cx| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue