mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: When searching in normal mode, have spaces in the search expression match multiple spaces and line breaks in the text. Fixes #1868847 [Edit Book Find feature does not find consistently.](https://bugs.launchpad.net/calibre/+bug/1868847)
This commit is contained in:
parent
f6f418fcb0
commit
779f674aa8
@ -208,7 +208,8 @@ class ModeBox(QComboBox):
|
||||
'''Select how the search expression is interpreted
|
||||
<dl>
|
||||
<dt><b>Normal</b></dt>
|
||||
<dd>The search expression is treated as normal text, calibre will look for the exact text.</dd>
|
||||
<dd>The search expression is treated as normal text, calibre will look for the exact text,
|
||||
except that spaces are allowed to match any number of spaces and line breaks.</dd>
|
||||
<dt><b>Regex</b></dt>
|
||||
<dd>The search expression is interpreted as a regular expression. See the User Manual for more help on using regular expressions.</dd>
|
||||
<dt><b>Regex-function</b></dt>
|
||||
@ -1272,7 +1273,8 @@ def get_search_regex(state):
|
||||
raw = state['find']
|
||||
is_regex = state['mode'] != 'normal'
|
||||
if not is_regex:
|
||||
raw = regex.escape(raw, special_only=True)
|
||||
parts = (regex.escape(x, special_only=True) for x in raw.split())
|
||||
raw = r'\s+'.join(parts)
|
||||
flags = REGEX_FLAGS
|
||||
if not state['case_sensitive']:
|
||||
flags |= regex.IGNORECASE
|
||||
|
Loading…
x
Reference in New Issue
Block a user