aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorjeepee2022-04-01 13:16:09 +0000
committerGitHub2022-04-01 13:16:09 +0000
commit8165febe23cbd8bb9cd99cceac9d09b81f35456e (patch)
tree47ddf833348c3cc9c6170f5475c876153db67fee /helix-term
parent47fe7397574208ecdcccc63770ce1b0374de1126 (diff)
Fix start-position of next search (#1904)
The search implementation would start searching at the next grapheme boundary after the previous selection. In case the next occurence of the needle is immediately after the current selection, this occurence would not be found (without wraparound) because the first grapheme is skipped. The correct approach is to use the ensure_grapheme_boundary functions instead of using the functions that skip unconditionally to the next grapheme.
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 104db459..f4844170 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -1488,11 +1488,11 @@ fn search_impl(
// Get the right side of the primary block cursor for forward search, or the
// grapheme before the start of the selection for reverse search.
let start = match direction {
- Direction::Forward => text.char_to_byte(graphemes::next_grapheme_boundary(
+ Direction::Forward => text.char_to_byte(graphemes::ensure_grapheme_boundary_next(
text,
selection.primary().to(),
)),
- Direction::Backward => text.char_to_byte(graphemes::prev_grapheme_boundary(
+ Direction::Backward => text.char_to_byte(graphemes::ensure_grapheme_boundary_prev(
text,
selection.primary().from(),
)),