on master help sign in
Fix incorrect behavior of `find_char` command and friends.
e6e0d31Nathan Vegdahl
helix-term/src/commands.rs+7−2
@@ -654,8 +654,13 @@ where
654 range.head
654 range.head
655 };
655 };
656
656
657− search_fn(text, ch, search_start_pos, count, inclusive)
657+ search_fn(text, ch, search_start_pos, count, inclusive).map_or(range, |pos| {
658− .map_or(range, |pos| range.put_cursor(text, pos, extend))
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+ })
659 });
664 });
660 doc.set_selection(view.id, selection);
665 doc.set_selection(view.id, selection);
661 })
666 })