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:
parent
690ad29ba9
commit
1b44398967
4 changed files with 24 additions and 31 deletions
|
@ -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)]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue