This commit is contained in:
Kovid Goyal 2019-12-15 18:19:32 +05:30
parent c7f8350eca
commit 8c382e7e4f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -871,13 +871,14 @@ class PythonHighlighter(QSyntaxHighlighter): # {{{
("error", "#FF0000", False, False), ("error", "#FF0000", False, False),
("pyqt", "#50621A", False, False)): ("pyqt", "#50621A", False, False)):
format = QTextCharFormat(baseFormat) fmt = QTextCharFormat(baseFormat)
if color is not None: if color is not None:
format.setForeground(QColor(color)) fmt.setForeground(QColor(color))
if bold: if bold:
format.setFontWeight(QFont.Bold) fmt.setFontWeight(QFont.Bold)
format.setFontItalic(italic) if italic:
cls.Formats[name] = format fmt.setFontItalic(italic)
cls.Formats[name] = fmt
def highlightBlock(self, text): def highlightBlock(self, text):
NORMAL, TRIPLESINGLE, TRIPLEDOUBLE, ERROR = range(4) NORMAL, TRIPLESINGLE, TRIPLEDOUBLE, ERROR = range(4)