E-book viewer: Fix incorrect sorting of highlights from the first internal file of a book. Fixes #1972069 [Annotations Sometimes List Out Of Order](https://bugs.launchpad.net/calibre/+bug/1972069)

This commit is contained in:
Kovid Goyal 2022-05-25 08:35:31 +05:30
parent 5e5cd0f4a7
commit bcb501b6de
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -277,7 +277,8 @@ class Highlights(QTreeWidget):
def cfi_key(h):
cfi = h.get('start_cfi')
return (h.get('spine_index') or defval[0], cfi_sort_key(cfi)) if cfi else defval
si = h.get('spine_index')
return (defval[0] if si is None else si, cfi_sort_key(cfi)) if cfi else defval
return sorted(highlights, key=cfi_key)