From 3cb084cc4e3cc989895d0eabf0ccc690c15d19ed Mon Sep 17 00:00:00 2001 From: Liam Dyer Date: Sun, 20 Oct 2024 20:11:22 -0400 Subject: [PATCH] fix: single char non-matching keyword closes #141 --- lua/blink/cmp/fuzzy/init.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/blink/cmp/fuzzy/init.lua b/lua/blink/cmp/fuzzy/init.lua index b6338b5d..3e09b9ad 100644 --- a/lua/blink/cmp/fuzzy/init.lua +++ b/lua/blink/cmp/fuzzy/init.lua @@ -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