mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Workaround for Firefox bug that broke searching backwards across file boundaries. Fixes #1895388 [Private bug](https://bugs.launchpad.net/calibre/+bug/1895388)
This commit is contained in:
parent
eecac78739
commit
06404ae119
@ -703,7 +703,19 @@ class IframeBoss:
|
|||||||
self.last_search_at = window.performance.now()
|
self.last_search_at = window.performance.now()
|
||||||
if data.searched_in_spine:
|
if data.searched_in_spine:
|
||||||
window.getSelection().removeAllRanges()
|
window.getSelection().removeAllRanges()
|
||||||
if window.find(data.text, False, data.backwards, from_load and data.backwards):
|
wrap_search = from_load and data.backwards
|
||||||
|
found = window.find(data.text, False, data.backwards, wrap_search)
|
||||||
|
if not found and wrap_search:
|
||||||
|
# wrapping is not implemented on Firefox
|
||||||
|
prev_range = None
|
||||||
|
while window.find(data.text, False):
|
||||||
|
prev_range = window.getSelection().getRangeAt(0)
|
||||||
|
if prev_range:
|
||||||
|
sel = window.getSelection()
|
||||||
|
sel.removeAllRanges()
|
||||||
|
sel.addRange(prev_range)
|
||||||
|
found = window.find(data.text, False, True)
|
||||||
|
if found:
|
||||||
if current_layout_mode() is not 'flow':
|
if current_layout_mode() is not 'flow':
|
||||||
snap_to_selection()
|
snap_to_selection()
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user