mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Escape leading periods with a second periond on non-hierarchical item searches.
This commit is contained in:
parent
6ef6e9d6b9
commit
509e014996
@ -1591,9 +1591,11 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
if tag in nodes_seen:
|
if tag in nodes_seen:
|
||||||
continue
|
continue
|
||||||
nodes_seen.add(tag)
|
nodes_seen.add(tag)
|
||||||
|
n = name.replace(r'"', r'\"')
|
||||||
|
if name.startswith('.'):
|
||||||
|
n = '.' + n
|
||||||
ans.append('%s%s:"=%s%s"'%(prefix, category,
|
ans.append('%s%s:"=%s%s"'%(prefix, category,
|
||||||
'.' if use_prefix else '',
|
'.' if use_prefix else '', n))
|
||||||
name.replace(r'"', r'\"')))
|
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
def find_item_node(self, key, txt, start_path, equals_match=False):
|
def find_item_node(self, key, txt, start_path, equals_match=False):
|
||||||
|
@ -121,11 +121,17 @@ CONTAINS_MATCH = 0
|
|||||||
EQUALS_MATCH = 1
|
EQUALS_MATCH = 1
|
||||||
REGEXP_MATCH = 2
|
REGEXP_MATCH = 2
|
||||||
def _match(query, value, matchkind):
|
def _match(query, value, matchkind):
|
||||||
|
if query.startswith('..'):
|
||||||
|
print 'here', query
|
||||||
|
query = query[1:]
|
||||||
|
prefix_match_ok = False
|
||||||
|
else:
|
||||||
|
prefix_match_ok = True
|
||||||
for t in value:
|
for t in value:
|
||||||
t = icu_lower(t)
|
t = icu_lower(t)
|
||||||
try: ### ignore regexp exceptions, required because search-ahead tries before typing is finished
|
try: ### ignore regexp exceptions, required because search-ahead tries before typing is finished
|
||||||
if (matchkind == EQUALS_MATCH):
|
if (matchkind == EQUALS_MATCH):
|
||||||
if query[0] == '.':
|
if prefix_match_ok and query[0] == '.':
|
||||||
if t.startswith(query[1:]):
|
if t.startswith(query[1:]):
|
||||||
ql = len(query) - 1
|
ql = len(query) - 1
|
||||||
if (len(t) == ql) or (t[ql:ql+1] == '.'):
|
if (len(t) == ql) or (t[ql:ql+1] == '.'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user