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.
This commit is contained in:
Kovid Goyal 2023-02-02 18:07:34 +05:30
parent 40ca12ff39
commit 1fb7f72fd0
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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):