diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a0f9910ca..1b3c3cd61d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,11 @@ # QOwnNotes Changelog +## 22.10.1 +- disabling of the Markdown highlighting now also works after a restart of + the application (for [#2622](https://github.com/pbek/QOwnNotes/issues/2622)) + ## 22.10.0 -- Exporting and printing of the selected text in the note text edit now really only +- exporting and printing of the selected text in the note text edit now really only uses the selected text again (for [#2618](https://github.com/pbek/QOwnNotes/issues/2618)) ## 22.9.2 diff --git a/src/widgets/qownnotesmarkdowntextedit.cpp b/src/widgets/qownnotesmarkdowntextedit.cpp index 3f91e9e2ce..5fe718c5ff 100644 --- a/src/widgets/qownnotesmarkdowntextedit.cpp +++ b/src/widgets/qownnotesmarkdowntextedit.cpp @@ -28,6 +28,8 @@ QOwnNotesMarkdownTextEdit::QOwnNotesMarkdownTextEdit(QWidget *parent) : QMarkdownTextEdit(parent, false) { mainWindow = nullptr; + // We need to set the internal variable to true, because we start with a highlighter + _highlightingEnabled = true; _highlighter = nullptr; if (parent->objectName() != QStringLiteral("LogWidget")) { _highlighter = new QOwnNotesMarkdownHighlighter(document()); @@ -110,7 +112,9 @@ void QOwnNotesMarkdownTextEdit::setFormatStyle( MarkdownHighlighter::HighlighterState index) { QTextCharFormat format; Utils::Schema::schemaSettings->setFormatStyle(index, format); - _highlighter->setTextFormat(index, format); + if (_highlighter) { + _highlighter->setTextFormat(index, format); + } } /** @@ -304,7 +308,9 @@ int QOwnNotesMarkdownTextEdit::modifyFontSize(FontModificationMode mode) { if (doSetStyles) { this->setStyles(); - _highlighter->rehighlight(); + if (_highlighter) { + _highlighter->rehighlight(); + } } return fontSize; @@ -885,7 +891,9 @@ void QOwnNotesMarkdownTextEdit::updateSettings() { if (highlightingEnabled) { // set the new highlighting styles setStyles(); - _highlighter->rehighlight(); + if (_highlighter) { + _highlighter->rehighlight(); + } } }