From 1fb7f72fd078b27d34bbce05ba3c1ddcef49504e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 2 Feb 2023 18:07:34 +0530 Subject: [PATCH] E-book viewer: Fix occasional false warning about highlight being overwritten. Fixes #2003916 [Overlapping highlights not detected properly (inconsistent)](https://bugs.launchpad.net/calibre/+bug/2003916) all_annots_in_selection should return a list of unique uuids. --- src/pyj/range_utils.pyj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pyj/range_utils.pyj b/src/pyj/range_utils.pyj index 1217f3db9f..1f6c697fd6 100644 --- a/src/pyj/range_utils.pyj +++ b/src/pyj/range_utils.pyj @@ -65,17 +65,17 @@ def all_annots_in_range(r, annot_id_uuid_map, ans): if node.dataset and node.dataset.calibreRangeWrapper: annot_id = annot_id_uuid_map[node.dataset.calibreRangeWrapper] if annot_id: - ans.push(annot_id) + ans[annot_id] = True if not is_full_tree and node.isSameNode(r.endContainer): break return ans def all_annots_in_selection(sel, annot_id_uuid_map): - ans = v'[]' + ans = v'{}' for i in range(sel.rangeCount): all_annots_in_range(sel.getRangeAt(i), annot_id_uuid_map, ans) - return ans + return Object.keys(ans) def remove(node):