aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/selection.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-core/src/selection.rs')
-rw-r--r--helix-core/src/selection.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/helix-core/src/selection.rs b/helix-core/src/selection.rs
index 259b131a..9e366c33 100644
--- a/helix-core/src/selection.rs
+++ b/helix-core/src/selection.rs
@@ -522,7 +522,14 @@ impl Selection {
self
}
- // Merges all ranges that are consecutive
+ /// Replaces ranges with one spanning from first to last range.
+ pub fn merge_ranges(self) -> Self {
+ let first = self.ranges.first().unwrap();
+ let last = self.ranges.last().unwrap();
+ Selection::new(smallvec![first.merge(*last)], 0)
+ }
+
+ /// Merges all ranges that are consecutive.
pub fn merge_consecutive_ranges(mut self) -> Self {
let mut primary = self.ranges[self.primary_index];