on master help sign in
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.

commite6e0d31be0546481e69be9ae11dc19b341746f42 authorNathan Vegdahl <cessen@cessen.com> dateThu 29 Jul 2021, 17:56 (5 years ago) parent3fda350
1 file changed+7−2
helix-term/src/commands.rs+7−2
helix-term/src/commands.rs+7−2
@@ -654,8 +654,13 @@ where
654654 range.head
655655 };
656656
657− search_fn(text, ch, search_start_pos, count, inclusive)
658− .map_or(range, |pos| range.put_cursor(text, pos, extend))
657+ search_fn(text, ch, search_start_pos, count, inclusive).map_or(range, |pos| {
658+ if extend {
659+ range.put_cursor(text, pos, true)
660+ } else {
661+ Range::point(range.cursor(text)).put_cursor(text, pos, true)
662+ }
663+ })
659664 });
660665 doc.set_selection(view.id, selection);
661666 })