Skip to content

Commit

Permalink
fix: prefix slicing using chars instead of bytes
Browse files Browse the repository at this point in the history
Closes #936
  • Loading branch information
Saghen committed Jan 16, 2025
1 parent ce76f54 commit 93541e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/blink/cmp/fuzzy/keyword.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ pub fn guess_keyword_range_from_item(
let line_range = get_keyword_range(line, cursor_col, match_suffix);
let text_range = get_keyword_range(item_text, item_text.len(), false);

let line_prefix = line.chars().take(line_range.0).collect::<String>();
let text_prefix = item_text.chars().take(text_range.0).collect::<String>();
let line_prefix = &line[..text_range.0];
let text_prefix = &item_text[..text_range.0];
if line_prefix.ends_with(&text_prefix) {
return (line_range.0 - text_prefix.len(), line_range.1);
}
Expand Down

0 comments on commit 93541e4

Please sign in to comment.