Allow selecting all search matches in buffer

This commit is contained in:
Kirill Bulatov
2023-07-14 14:47:12 +03:00
parent bf9dfa3b51
commit 29cbeb39bd
10 changed files with 146 additions and 16 deletions
+5
View File
@@ -941,6 +941,11 @@ impl SearchableItem for Editor {
});
}
fn select_matches(&mut self, matches: Vec<Self::Match>, cx: &mut ViewContext<Self>) {
self.unfold_ranges(matches.clone(), false, false, cx);
self.change_selections(None, cx, |s| s.select_ranges(matches));
}
fn match_index_for_direction(
&mut self,
matches: &Vec<Range<Anchor>>,
+2 -2
View File
@@ -16,13 +16,13 @@ use crate::{
Anchor, DisplayPoint, ExcerptId, MultiBuffer, MultiBufferSnapshot, SelectMode, ToOffset,
};
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct PendingSelection {
pub selection: Selection<Anchor>,
pub mode: SelectMode,
}
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct SelectionsCollection {
display_map: ModelHandle<DisplayMap>,
buffer: ModelHandle<MultiBuffer>,