on master help sign in
Fix range.overlap()
35b4fe4Blaž Hrastnik
helix-core/src/selection.rs+5−5
@@ -59,11 +59,11 @@ impl Range {
59 #[must_use]
59 #[must_use]
60 pub fn overlaps(&self, other: &Self) -> bool {
60 pub fn overlaps(&self, other: &Self) -> bool {
61 // cursor overlap is checked differently
61 // cursor overlap is checked differently
62− if self.is_empty() {
62+ // if self.is_empty() {
63− self.from() <= other.to()
63+ // self.from() <= other.to()
64− } else {
64+ // } else {
65− self.from() < other.to()
65+ self.to() >= other.from() && other.to() >= self.from()
66− }
66+ // }
67 }
67 }
68
68
69 pub fn contains(&self, pos: usize) -> bool {
69 pub fn contains(&self, pos: usize) -> bool {