diff options
Diffstat (limited to 'helix-core/src/selection.rs')
-rw-r--r-- | helix-core/src/selection.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/helix-core/src/selection.rs b/helix-core/src/selection.rs index a196417a..f6ca424f 100644 --- a/helix-core/src/selection.rs +++ b/helix-core/src/selection.rs @@ -211,11 +211,14 @@ impl Selection { } /// Takes a closure and maps each selection over the closure. - pub fn transform<F>(self, f: F) -> Self + pub fn transform<F>(&self, f: F) -> Self where F: Fn(Range) -> Range, { - Self::new(self.ranges.into_iter().map(f).collect(), self.primary_index) + Self::new( + self.ranges.iter().copied().map(f).collect(), + self.primary_index, + ) } } |