From a3028e7523cede479f5637e97636ad66a5a7b918 Mon Sep 17 00:00:00 2001 From: Raghu Rajagopalan Date: Fri, 28 Sep 2018 16:30:00 +0530 Subject: [PATCH] Better match highlight regex --- rplugin/python3/denite/filter/matcher/fruzzymatcher.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rplugin/python3/denite/filter/matcher/fruzzymatcher.py b/rplugin/python3/denite/filter/matcher/fruzzymatcher.py index 8e243b8..ca81686 100644 --- a/rplugin/python3/denite/filter/matcher/fruzzymatcher.py +++ b/rplugin/python3/denite/filter/matcher/fruzzymatcher.py @@ -66,7 +66,12 @@ def scoreMatchesProxy(self, q, c, limit, key=None, ispath=True): return fruzzy.scoreMatches(q, c, limit, key, ispath) def convert_pattern(self, input_str): - # return convert2fuzzy_pattern(input_str) - p = convert2fuzzy_pattern(input_str) + if not input_str: + return input_str + pat = "" + for c in input_str[:-1]: + pat = pat + "%s[^%s]{-}" % (c, c) + p = pat + input_str[-1] + # p = convert2fuzzy_pattern(input_str) # self.debug("pattern: %s : %s" % (input_str, p)) return p