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.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/helix-core/src/selection.rs b/helix-core/src/selection.rs
index 0db7634c..0eb2b755 100644
--- a/helix-core/src/selection.rs
+++ b/helix-core/src/selection.rs
@@ -625,11 +625,6 @@ impl Selection {
// returns true if self ⊇ other
pub fn contains(&self, other: &Selection) -> bool {
- // can't contain other if it is larger
- if other.len() > self.len() {
- return false;
- }
-
let (mut iter_self, mut iter_other) = (self.iter(), other.iter());
let (mut ele_self, mut ele_other) = (iter_self.next(), iter_other.next());
@@ -1240,5 +1235,11 @@ mod test {
vec!((3, 4), (7, 9))
));
assert!(!contains(vec!((1, 1), (5, 6)), vec!((1, 6))));
+
+ // multiple ranges of other are all contained in some ranges of self,
+ assert!(contains(
+ vec!((1, 4), (7, 10)),
+ vec!((1, 2), (3, 4), (7, 9))
+ ));
}
}