aboutsummaryrefslogtreecommitdiff
path: root/helix-core
diff options
context:
space:
mode:
Diffstat (limited to 'helix-core')
-rw-r--r--helix-core/src/selection.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/helix-core/src/selection.rs b/helix-core/src/selection.rs
index f1625f99..c08f504d 100644
--- a/helix-core/src/selection.rs
+++ b/helix-core/src/selection.rs
@@ -357,14 +357,14 @@ impl Selection {
let mut prev_i = 0;
for i in 1..self.ranges.len() {
if self.ranges[prev_i].overlaps(&self.ranges[i]) {
- if i == self.primary_index {
- self.primary_index = prev_i;
- }
self.ranges[prev_i] = self.ranges[prev_i].merge(self.ranges[i]);
} else {
prev_i += 1;
self.ranges[prev_i] = self.ranges[i];
}
+ if i == self.primary_index {
+ self.primary_index = prev_i;
+ }
}
self.ranges.truncate(prev_i + 1);