Limit the amount of highlighted text displayed in the highlights panel

This commit is contained in:
Kovid Goyal 2020-07-26 14:05:38 +05:30
parent 1fcd002121
commit d90e866e9b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

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