1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00

Impliment fix in #436

This commit is contained in:
Christopher Musselle 2019-02-26 23:55:20 +00:00
parent 06e082c918
commit 36fcadd18f

View File

@ -75,9 +75,10 @@ def match_consecutive(needles, haystack, ignore_case=False):
(path='/foo/baz', weight=10), (path='/foo/baz', weight=10),
] ]
""" """
regex_no_sep = '[^' + os.sep + ']*' sep = '\\\\' if os.sep == '\\' else os.sep
regex_no_sep = '[^' + sep + ']*'
regex_no_sep_end = regex_no_sep + '$' regex_no_sep_end = regex_no_sep + '$'
regex_one_sep = regex_no_sep + os.sep + regex_no_sep regex_one_sep = regex_no_sep + sep + regex_no_sep
regex_needle = regex_one_sep.join(imap(re.escape, needles)) + regex_no_sep_end regex_needle = regex_one_sep.join(imap(re.escape, needles)) + regex_no_sep_end
regex_flags = re.IGNORECASE | re.UNICODE if ignore_case else re.UNICODE regex_flags = re.IGNORECASE | re.UNICODE if ignore_case else re.UNICODE
found = lambda entry: re.search( found = lambda entry: re.search(