From 6fc275fe70cfd198cb916f618d9d1fd323c6697e Mon Sep 17 00:00:00 2001 From: Patrizio Bekerle Date: Tue, 10 Sep 2024 14:39:31 +0200 Subject: [PATCH] pbek/QOwnNotes#3101 fix: malfunctioning ordered list detection in heading highlighting Signed-off-by: Patrizio Bekerle --- markdownhighlighter.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/markdownhighlighter.cpp b/markdownhighlighter.cpp index c47957a..81fb24c 100644 --- a/markdownhighlighter.cpp +++ b/markdownhighlighter.cpp @@ -499,9 +499,12 @@ static bool isParagraph(const QString &text) { else break; } - if (textView[i] == QLatin1Char('.') || - textView[i] == QLatin1Char(')')) { - return false; + if (i < textView.size() && + (textView[i] == QLatin1Char('.') || textView[i] == QLatin1Char(')'))) { + // Check if there's a next character and if it's a space + if (i + 1 < textView.size() && textView[i + 1].isSpace()) { + return false; + } } }