From 285aba2de5af5d7a45b0640e7e09764b611f6a7b Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Wed, 28 Jul 2021 16:03:34 -0700 Subject: Fix bug with `/` searching after non-ascii characters. Forgot to convert from char indices to byte indices before passing to the regex engine. --- helix-term/src/commands.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index e01ee6cf..baa3e897 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1017,7 +1017,10 @@ fn search_impl(doc: &mut Document, view: &mut View, contents: &str, regex: &Rege let selection = doc.selection(view.id); // Get the right side of the primary block cursor. - let start = graphemes::next_grapheme_boundary(text, selection.primary().cursor(text)); + let start = text.char_to_byte(graphemes::next_grapheme_boundary( + text, + selection.primary().cursor(text), + )); // use find_at to find the next match after the cursor, loop around the end // Careful, `Regex` uses `bytes` as offsets, not character indices! -- cgit v1.2.3-70-g09d2