aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs22
1 files changed, 13 insertions, 9 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index f5bf6bf1..2d455df0 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -5002,16 +5002,20 @@ fn increment_impl(cx: &mut Context, increment_direction: IncrementDirection) {
overlapping_indexes.insert(i + 1);
}
}
- let changes = changes.into_iter().enumerate().filter_map(|(i, change)| {
- if overlapping_indexes.contains(&i) {
- None
- } else {
- Some(change)
- }
- });
+ let changes: Vec<_> = changes
+ .into_iter()
+ .enumerate()
+ .filter_map(|(i, change)| {
+ if overlapping_indexes.contains(&i) {
+ None
+ } else {
+ Some(change)
+ }
+ })
+ .collect();
- if changes.clone().count() > 0 {
- let transaction = Transaction::change(doc.text(), changes);
+ if !changes.is_empty() {
+ let transaction = Transaction::change(doc.text(), changes.into_iter());
let transaction = transaction.with_selection(selection.clone());
apply_transaction(&transaction, doc, view);