mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-22 04:43:36 +02:00
...
This commit is contained in:
parent
af0e127004
commit
b0701cc4a6
1 changed files with 1 additions and 1 deletions
|
|
@ -155,7 +155,7 @@ def search_in_name(name, search_query, ctx_size=50):
|
|||
raw = searchable_text_for_name(name)
|
||||
for match in search_query.regex.finditer(raw):
|
||||
start, end = match.span()
|
||||
before = raw[start-ctx_size:start]
|
||||
before = raw[max(0, start-ctx_size):start]
|
||||
after = raw[end:end+ctx_size]
|
||||
yield before, match.group(), after
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue