From 46aed33cf73ddf8d875ca27b5f35062f1737075d Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Wed, 26 Nov 2025 13:37:13 +1100 Subject: [PATCH] Ensure toolbar is always loaded at end of MainWindow init (weird random bug) --- bouquin/main_window.py | 3 +++ bouquin/markdown_highlighter.py | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bouquin/main_window.py b/bouquin/main_window.py index 9f04347..480d0f8 100644 --- a/bouquin/main_window.py +++ b/bouquin/main_window.py @@ -356,6 +356,9 @@ class MainWindow(QMainWindow): self._day_change_timer.timeout.connect(self._on_day_changed) self._schedule_next_day_change() + # Ensure toolbar is definitely visible + self.toolBar.setVisible(True) + @property def editor(self) -> MarkdownEditor | None: """Get the currently active editor.""" diff --git a/bouquin/markdown_highlighter.py b/bouquin/markdown_highlighter.py index caff702..8077842 100644 --- a/bouquin/markdown_highlighter.py +++ b/bouquin/markdown_highlighter.py @@ -117,10 +117,13 @@ class MarkdownHighlighter(QSyntaxHighlighter): # Markdown syntax (the markers themselves) - make invisible self.syntax_format = QTextCharFormat() + # Use the editor background color so they blend in + bg = pal.color(QPalette.Base) + hidden = QColor(bg) + hidden.setAlpha(0) + self.syntax_format.setForeground(hidden) # Make the markers invisible by setting font size to 0.1 points self.syntax_format.setFontPointSize(0.1) - # Also make them very faint in case they still show - self.syntax_format.setForeground(QColor(250, 250, 250)) def _overlay_range( self, start: int, length: int, overlay_fmt: QTextCharFormat