mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-06 18:46:49 +00:00
Implement SelectionsCollection::select_anchor_ranges
This commit is contained in:
parent
0d31722589
commit
fc2251e7ed
1 changed files with 26 additions and 25 deletions
|
@ -595,31 +595,32 @@ impl<'a> MutableSelectionsCollection<'a> {
|
||||||
self.select(selections)
|
self.select(selections)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn select_anchor_ranges<I: IntoIterator<Item = Range<Anchor>>>(&mut self, ranges: I) {
|
pub fn select_anchor_ranges<I>(&mut self, ranges: I)
|
||||||
todo!()
|
where
|
||||||
// let buffer = self.buffer.read(self.cx).snapshot(self.cx);
|
I: IntoIterator<Item = Range<Anchor>>,
|
||||||
// let selections = ranges
|
{
|
||||||
// .into_iter()
|
let buffer = self.buffer.read(self.cx).snapshot(self.cx);
|
||||||
// .map(|range| {
|
let selections = ranges
|
||||||
// let mut start = range.start;
|
.into_iter()
|
||||||
// let mut end = range.end;
|
.map(|range| {
|
||||||
// let reversed = if start.cmp(&end, &buffer).is_gt() {
|
let mut start = range.start;
|
||||||
// mem::swap(&mut start, &mut end);
|
let mut end = range.end;
|
||||||
// true
|
let reversed = if start.cmp(&end, &buffer).is_gt() {
|
||||||
// } else {
|
mem::swap(&mut start, &mut end);
|
||||||
// false
|
true
|
||||||
// };
|
} else {
|
||||||
// Selection {
|
false
|
||||||
// id: post_inc(&mut self.collection.next_selection_id),
|
};
|
||||||
// start,
|
Selection {
|
||||||
// end,
|
id: post_inc(&mut self.collection.next_selection_id),
|
||||||
// reversed,
|
start,
|
||||||
// goal: SelectionGoal::None,
|
end,
|
||||||
// }
|
reversed,
|
||||||
// })
|
goal: SelectionGoal::None,
|
||||||
// .collect::<Vec<_>>();
|
}
|
||||||
|
})
|
||||||
// self.select_anchors(selections)
|
.collect::<Vec<_>>();
|
||||||
|
self.select_anchors(selections)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_selection_id(&mut self) -> usize {
|
pub fn new_selection_id(&mut self) -> usize {
|
||||||
|
|
Loading…
Reference in a new issue