diff options
author | Nathan Vegdahl | 2021-07-20 18:58:56 +0000 |
---|---|---|
committer | Nathan Vegdahl | 2021-07-20 18:58:56 +0000 |
commit | 1c6b5581f01371a00dc7f6f6e1720ad8af61ec7a (patch) | |
tree | c1758df277987266251500fc5c864f1def5c715c /helix-core | |
parent | e8a3980e464a9c98c3f76cada6c46a66498dc2bf (diff) |
Fix various bugs related to goto-end-of-line command.
This also fixes a bug with `Selection::normalize()`, that could
result in an out-of-bounds primary index.
Diffstat (limited to 'helix-core')
-rw-r--r-- | helix-core/src/selection.rs | 6 |
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); |