Skip to content

Commit

Permalink
fix: single char non-matching keyword
Browse files Browse the repository at this point in the history
closes #141
  • Loading branch information
Saghen committed Oct 21, 2024
1 parent 57abdb8 commit 3cb084c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lua/blink/cmp/fuzzy/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ function fuzzy.get_query()
cmp_config.keyword_regex,
cmp_config.exclude_from_prefix_regex
)
-- Since sub(1, 1) returns a single char string, we need to check if that single char matches
-- and otherwise return an empty string
if range[1] == range[2] and line:sub(range[1] + 1, range[1] + 1):match(cmp_config.keyword_regex) == nil then
return ''
end
return string.sub(line, range[1] + 1, range[2] + 1)
end

Expand Down

0 comments on commit 3cb084c

Please sign in to comment.