More markdown tests
This commit is contained in:
parent
95b7d828b5
commit
3b3087cc37
2 changed files with 974 additions and 1 deletions
|
|
@ -118,9 +118,12 @@ class MarkdownEditor(QTextEdit):
|
|||
)
|
||||
|
||||
def setDocument(self, doc):
|
||||
super().setDocument(doc)
|
||||
# Recreate the highlighter for the new document
|
||||
# (the old one gets deleted with the old document)
|
||||
if doc is None:
|
||||
return
|
||||
|
||||
super().setDocument(doc)
|
||||
if hasattr(self, "highlighter") and hasattr(self, "theme_manager"):
|
||||
self.highlighter = MarkdownHighlighter(
|
||||
self.document(), self.theme_manager, self
|
||||
|
|
@ -214,6 +217,9 @@ class MarkdownEditor(QTextEdit):
|
|||
if doc is None:
|
||||
return
|
||||
|
||||
if not hasattr(self, "highlighter") or self.highlighter is None:
|
||||
return
|
||||
|
||||
bg_brush = self.highlighter.code_block_format.background()
|
||||
|
||||
selections: list[QTextEdit.ExtraSelection] = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue