aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-03-19 02:14:13 +0000
committerBlaž Hrastnik2021-03-19 02:14:13 +0000
commitf29f01858d1b8c9e54b3293879796a4650823f60 (patch)
tree6aeb9434e110adcdbe533c0519d7dd0e2993c88b /helix-term
parente9bd9e72c3adf822ae569644dd87f4a5e04df18e (diff)
Implement iter() and len() directly on Selection.
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs6
-rw-r--r--helix-term/src/ui/editor.rs1
2 files changed, 2 insertions, 5 deletions
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<usize> {
let mut lines = selection
- .ranges()
.iter()
.map(|range| doc.char_to_line(range.head))
.collect::<Vec<_>>();
@@ -1145,7 +1144,7 @@ fn get_lines(doc: &Document) -> Vec<usize> {
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<lsp::Range> = 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))
{