Make SelectionsCollection::disjoint_anchor_ranges return an iterator (#22948)
This helps discourage unnecessary collection to Vec Release Notes: - N/A
This commit is contained in:
@@ -185,9 +185,12 @@ pub fn register(editor: &mut Editor, cx: &mut ViewContext<Vim>) {
|
||||
|
||||
let previous_selections = vim
|
||||
.update_editor(cx, |_, editor, cx| {
|
||||
let selections = action
|
||||
.restore_selection
|
||||
.then(|| editor.selections.disjoint_anchor_ranges());
|
||||
let selections = action.restore_selection.then(|| {
|
||||
editor
|
||||
.selections
|
||||
.disjoint_anchor_ranges()
|
||||
.collect::<Vec<_>>()
|
||||
});
|
||||
editor.change_selections(None, cx, |s| {
|
||||
let end = Point::new(range.end.0, s.buffer().line_len(range.end));
|
||||
s.select_ranges([end..Point::new(range.start.0, 0)]);
|
||||
|
||||
Reference in New Issue
Block a user