From e98d669c303576802291ef9826a22066e4191808 Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Mon, 19 Jul 2021 12:30:08 -0700 Subject: Handle edge case in `range_to_target()` correctly. --- helix-core/src/movement.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 { -- cgit v1.2.3-70-g09d2