Fix searching for tags that start with a period

This commit is contained in:
Kovid Goyal 2011-03-02 13:19:00 -07:00
commit 8d5e009d61
2 changed files with 10 additions and 3 deletions

View File

@ -1599,9 +1599,11 @@ class TagsModel(QAbstractItemModel): # {{{
if tag in nodes_seen:
continue
nodes_seen.add(tag)
n = name.replace(r'"', r'\"')
if name.startswith('.'):
n = '.' + n
ans.append('%s%s:"=%s%s"'%(prefix, category,
'.' if use_prefix else '',
name.replace(r'"', r'\"')))
'.' if use_prefix else '', n))
return ans
def find_item_node(self, key, txt, start_path, equals_match=False):

View File

@ -121,11 +121,16 @@ CONTAINS_MATCH = 0
EQUALS_MATCH = 1
REGEXP_MATCH = 2
def _match(query, value, matchkind):
if query.startswith('..'):
query = query[1:]
prefix_match_ok = False
else:
prefix_match_ok = True
for t in value:
t = icu_lower(t)
try: ### ignore regexp exceptions, required because search-ahead tries before typing is finished
if (matchkind == EQUALS_MATCH):
if query[0] == '.':
if prefix_match_ok and query[0] == '.':
if t.startswith(query[1:]):
ql = len(query) - 1
if (len(t) == ql) or (t[ql:ql+1] == '.'):