mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: Text search: Fix searching for a single character backwards not working
This commit is contained in:
parent
36604c52ee
commit
64141ab21f
@ -733,12 +733,14 @@ class Smarts(NullSmarts):
|
||||
|
||||
return 'complete_names', (names_type, doc_name, c.root), query
|
||||
|
||||
def find_text(self, pat, cursor):
|
||||
def find_text(self, pat, cursor, reverse):
|
||||
from calibre.gui2.tweak_book.text_search import find_text_in_chunks
|
||||
chunks = []
|
||||
|
||||
cstart = min(cursor.position(), cursor.anchor())
|
||||
cend = max(cursor.position(), cursor.anchor())
|
||||
if reverse:
|
||||
cend -= 1
|
||||
c = QTextCursor(cursor)
|
||||
c.setPosition(cstart)
|
||||
block = c.block()
|
||||
|
@ -503,7 +503,7 @@ class TextEdit(PlainTextEdit):
|
||||
c.movePosition(pos, c.KeepAnchor)
|
||||
if hasattr(self.smarts, 'find_text'):
|
||||
self.highlighter.join()
|
||||
found, start, end = self.smarts.find_text(pat, c)
|
||||
found, start, end = self.smarts.find_text(pat, c, reverse)
|
||||
if not found:
|
||||
return False
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user