From cb41907196697e44d535a525057164e88f20e184 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 19 Jun 2023 10:33:50 +0530 Subject: [PATCH] Let the browser engine tell us if the selection is hidden or not --- src/pyj/read_book/find.pyj | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/pyj/read_book/find.pyj b/src/pyj/read_book/find.pyj index f6e34528c7..b25c9b83a1 100644 --- a/src/pyj/read_book/find.pyj +++ b/src/pyj/read_book/find.pyj @@ -2,8 +2,6 @@ # License: GPL v3 Copyright: 2020, Kovid Goyal from __python__ import bound_methods, hash_literals -from range_utils import select_first_node_from_range, is_node_visible - def build_text_map(): node_list = v'[]' 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) except: # if offset is outside node return False - if not sel.rangeCount: - return False - for i in range(sel.rangeCount): - if select_first_node_from_range(sel.getRangeAt(i), is_node_visible): - return True - return False + return bool(sel.rangeCount and sel.toString()) def select_search_result(sr):