mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Let the browser engine tell us if the selection is hidden or not
This commit is contained in:
parent
779598eec0
commit
cb41907196
@ -2,8 +2,6 @@
|
|||||||
# License: GPL v3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
|
# License: GPL v3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
|
||||||
from __python__ import bound_methods, hash_literals
|
from __python__ import bound_methods, hash_literals
|
||||||
|
|
||||||
from range_utils import select_first_node_from_range, is_node_visible
|
|
||||||
|
|
||||||
def build_text_map():
|
def build_text_map():
|
||||||
node_list = v'[]'
|
node_list = v'[]'
|
||||||
flat_text = ''
|
flat_text = ''
|
||||||
@ -141,12 +139,7 @@ def select_find_result(match):
|
|||||||
sel.setBaseAndExtent(match.start_node, match.start_offset, match.end_node, match.end_offset)
|
sel.setBaseAndExtent(match.start_node, match.start_offset, match.end_node, match.end_offset)
|
||||||
except: # if offset is outside node
|
except: # if offset is outside node
|
||||||
return False
|
return False
|
||||||
if not sel.rangeCount:
|
return bool(sel.rangeCount and sel.toString())
|
||||||
return False
|
|
||||||
for i in range(sel.rangeCount):
|
|
||||||
if select_first_node_from_range(sel.getRangeAt(i), is_node_visible):
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def select_search_result(sr):
|
def select_search_result(sr):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user