summaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorNathan Vegdahl2021-07-30 00:56:25 +0000
committerIvan Tham2021-07-30 01:39:18 +0000
commite6e0d31be0546481e69be9ae11dc19b341746f42 (patch)
tree9132ba87724247cd05f95dcfaa2c86e789192da5 /helix-term/src
parent3fda350494449bf5909a0b47f9e2f593fbe615ad (diff)
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.
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs9
1 files 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);
})