From baf9b41f44aab3a93ffa14355ca59191331f89cc Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Sun, 2 Nov 2025 10:21:42 +1100 Subject: [PATCH] Reduce size of preview. Fix jumping to the appropriate day in calendar when clicking on a search result --- bouquin/main_window.py | 2 ++ bouquin/search.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bouquin/main_window.py b/bouquin/main_window.py index bceaa8d..5208e7b 100644 --- a/bouquin/main_window.py +++ b/bouquin/main_window.py @@ -206,6 +206,8 @@ class MainWindow(QMainWindow): self._dirty = False # track which date the editor currently represents self._active_date_iso = date_iso + qd = QDate.fromString(date_iso, "yyyy-MM-dd") + self.calendar.setSelectedDate(qd) def _on_text_changed(self): self._dirty = True diff --git a/bouquin/search.py b/bouquin/search.py index 8177905..8cd2fd5 100644 --- a/bouquin/search.py +++ b/bouquin/search.py @@ -80,7 +80,7 @@ class Search(QWidget): for date_str, content in rows: # Build an HTML fragment around the match and whether to show ellipses frag_html, left_ell, right_ell = self._make_html_snippet( - content, query, radius=60, maxlen=180 + content, query, radius=30, maxlen=90 ) # ---- Per-item widget: date on top, preview row below (with ellipses) ---- @@ -112,7 +112,7 @@ class Search(QWidget): preview = QLabel() preview.setTextFormat(Qt.TextFormat.RichText) preview.setWordWrap(True) - preview.setOpenExternalLinks(True) # keep links in your HTML clickable + preview.setOpenExternalLinks(True) preview.setText( frag_html if frag_html