mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Limit the amount of highlighted text displayed in the highlights panel
This commit is contained in:
parent
1fcd002121
commit
d90e866e9b
@ -116,6 +116,9 @@ class Highlights(QListWidget):
|
|||||||
highlights = (h for h in highlights if not h.get('removed') and h.get('highlighted_text'))
|
highlights = (h for h in highlights if not h.get('removed') and h.get('highlighted_text'))
|
||||||
for h in self.sorted_highlights(highlights):
|
for h in self.sorted_highlights(highlights):
|
||||||
txt = h.get('highlighted_text')
|
txt = h.get('highlighted_text')
|
||||||
|
txt = txt.replace('\n', ' ')
|
||||||
|
if len(txt) > 100:
|
||||||
|
txt = txt[:100] + '…'
|
||||||
i = QListWidgetItem(txt, self)
|
i = QListWidgetItem(txt, self)
|
||||||
i.setData(Qt.UserRole, h)
|
i.setData(Qt.UserRole, h)
|
||||||
self.uuid_map[h['uuid']] = self.count() - 1
|
self.uuid_map[h['uuid']] = self.count() - 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user