Improve range-based selection queries to only resolve the requested selections

This commit is contained in:
Nathan Sobo
2021-11-25 13:19:49 -07:00
parent 09a53a0c64
commit d249618ee6
4 changed files with 59 additions and 39 deletions
+7 -5
View File
@@ -748,11 +748,13 @@ impl Element for EditorElement {
self.update_view(cx.app, |view, cx| {
highlighted_row = view.highlighted_row();
for selection_set_id in view.active_selection_sets(cx).collect::<Vec<_>>() {
let replica_selections = view.selections_in_range(
selection_set_id,
DisplayPoint::new(start_row, 0)..DisplayPoint::new(end_row, 0),
cx,
);
let replica_selections = view
.intersecting_selections(
selection_set_id,
DisplayPoint::new(start_row, 0)..DisplayPoint::new(end_row, 0),
cx,
)
.collect::<Vec<_>>();
for selection in &replica_selections {
if selection_set_id == view.selection_set_id {
let is_empty = selection.start == selection.end;