From e6e0d31be0546481e69be9ae11dc19b341746f42 Mon Sep 17 00:00:00 2001
From: Nathan Vegdahl <cessen@cessen.com>
Date: Thu, 29 Jul 2021 17:56:25 -0700
Subject: [PATCH] Fix incorrect behavior of `find_char` command and friends.

The non-extending variants of the commands weren't selecting from the range head.

Fixes #527.
---
 helix-term/src/commands.rs | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 87c496ce..2f071306 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -654,8 +654,13 @@ where
                 range.head
             };
 
-            search_fn(text, ch, search_start_pos, count, inclusive)
-                .map_or(range, |pos| range.put_cursor(text, pos, extend))
+            search_fn(text, ch, search_start_pos, count, inclusive).map_or(range, |pos| {
+                if extend {
+                    range.put_cursor(text, pos, true)
+                } else {
+                    Range::point(range.cursor(text)).put_cursor(text, pos, true)
+                }
+            })
         });
         doc.set_selection(view.id, selection);
     })