From 8c382e7e4f49e34eb190590353badb66a4e89554 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 15 Dec 2019 18:19:32 +0530 Subject: [PATCH] ... --- src/calibre/gui2/widgets.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/widgets.py b/src/calibre/gui2/widgets.py index e0ae0d70d7..2e2690156a 100644 --- a/src/calibre/gui2/widgets.py +++ b/src/calibre/gui2/widgets.py @@ -871,13 +871,14 @@ class PythonHighlighter(QSyntaxHighlighter): # {{{ ("error", "#FF0000", False, False), ("pyqt", "#50621A", False, False)): - format = QTextCharFormat(baseFormat) + fmt = QTextCharFormat(baseFormat) if color is not None: - format.setForeground(QColor(color)) + fmt.setForeground(QColor(color)) if bold: - format.setFontWeight(QFont.Bold) - format.setFontItalic(italic) - cls.Formats[name] = format + fmt.setFontWeight(QFont.Bold) + if italic: + fmt.setFontItalic(italic) + cls.Formats[name] = fmt def highlightBlock(self, text): NORMAL, TRIPLESINGLE, TRIPLEDOUBLE, ERROR = range(4)