aboutsummaryrefslogtreecommitdiff
path: root/helix-core
diff options
context:
space:
mode:
authorNathan Vegdahl2021-07-19 19:30:08 +0000
committerNathan Vegdahl2021-07-19 19:30:08 +0000
commite98d669c303576802291ef9826a22066e4191808 (patch)
treed9914c5c1398bc797b863b9eb28583fa776d2cf0 /helix-core
parentb0311f4fc246f370bb317ab0b1fcb89823347caa (diff)
Handle edge case in `range_to_target()` correctly.
Diffstat (limited to 'helix-core')
-rw-r--r--helix-core/src/movement.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/helix-core/src/movement.rs b/helix-core/src/movement.rs
index 2d9798bf..21e97ae8 100644
--- a/helix-core/src/movement.rs
+++ b/helix-core/src/movement.rs
@@ -285,7 +285,7 @@ impl CharHelpers for Chars<'_> {
// Find our target position(s).
let head_start = head;
while let Some(next_ch) = self.next() {
- if reached_target(target, prev_ch.unwrap_or(next_ch), next_ch) {
+ if prev_ch.is_none() || reached_target(target, prev_ch.unwrap(), next_ch) {
if head == head_start {
anchor = head;
} else {