From f29f01858d1b8c9e54b3293879796a4650823f60 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Fri, 19 Mar 2021 11:14:13 +0900 Subject: Implement iter() and len() directly on Selection. --- helix-term/src/commands.rs | 6 ++---- helix-term/src/ui/editor.rs | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'helix-term/src') diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 291f8577..f84bb16e 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -781,7 +781,6 @@ pub fn buffer_picker(cx: &mut Context) { // calculate line numbers for each selection range fn selection_lines(doc: &Rope, selection: &Selection) -> Vec { let mut lines = selection - .ranges() .iter() .map(|range| doc.char_to_line(range.head)) .collect::>(); @@ -1145,7 +1144,7 @@ fn get_lines(doc: &Document) -> Vec { let mut lines = Vec::new(); // Get all line numbers - for range in doc.selection().ranges() { + for range in doc.selection() { let start = doc.text().char_to_line(range.from()); let end = doc.text().char_to_line(range.to()); @@ -1220,7 +1219,6 @@ pub fn format_selections(cx: &mut Context) { let ranges: Vec = doc .selection() - .ranges() .iter() .map(|range| helix_lsp::util::range_to_lsp_range(doc.text(), *range)) .collect(); @@ -1257,7 +1255,7 @@ pub fn join_selections(cx: &mut Context) { let mut changes = Vec::new(); let fragment = Tendril::from(" "); - for selection in doc.selection().ranges() { + for selection in doc.selection() { let start = text.char_to_line(selection.from()); let mut end = text.char_to_line(selection.to()); if start == end { diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 5e8ef05e..670de6d6 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -211,7 +211,6 @@ impl EditorView { for selection in view .doc .selection() - .ranges() .iter() .filter(|range| range.overlaps(&screen)) { -- cgit v1.2.3-70-g09d2