aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Vegdahl2021-07-28 23:03:34 +0000
committerNathan Vegdahl2021-07-28 23:03:34 +0000
commit285aba2de5af5d7a45b0640e7e09764b611f6a7b (patch)
tree043613f9cc867eeb5f19cac2e7b380e968717120
parentcd7302ffd35c4972e7b0414a31a08f4e3c672df5 (diff)
Fix bug with `/` searching after non-ascii characters.
Forgot to convert from char indices to byte indices before passing to the regex engine.
-rw-r--r--helix-term/src/commands.rs5
1 files changed, 4 insertions, 1 deletions
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!