From d90e866e9b0d9274a481ed30dbff20d7513c4c07 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 26 Jul 2020 14:05:38 +0530 Subject: [PATCH] Limit the amount of highlighted text displayed in the highlights panel --- src/calibre/gui2/viewer/highlights.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/gui2/viewer/highlights.py b/src/calibre/gui2/viewer/highlights.py index b19e995ecd..8e5acf7d41 100644 --- a/src/calibre/gui2/viewer/highlights.py +++ b/src/calibre/gui2/viewer/highlights.py @@ -116,6 +116,9 @@ class Highlights(QListWidget): highlights = (h for h in highlights if not h.get('removed') and h.get('highlighted_text')) for h in self.sorted_highlights(highlights): txt = h.get('highlighted_text') + txt = txt.replace('\n', ' ') + if len(txt) > 100: + txt = txt[:100] + '…' i = QListWidgetItem(txt, self) i.setData(Qt.UserRole, h) self.uuid_map[h['uuid']] = self.count() - 1