From 18372ca5535c0d625e96106bad6e319f6699ab80 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 14 Sep 2023 13:59:01 +0200 Subject: [PATCH] TextEditor: Do not make one-letter doxygen commands end a rewrap region In 8e118e9d5ec92cdfdb2fb70d2d7ef3690cf89232, we stopped re-wrapping in comments when a doxygen/qdoc command appeared at the start of the line. However, there are also "inline" commands such as \l and \c that can by chance appear on the start of a line and should not stop rewrapping. Since we are still quite reluctant to enumerate and categorize the countless doxygen/qdoc commands, let's just ignore all one-letter commands for rewrapping purposes. (Yes, this is another hacky heuristic.) Fixes: QTCREATORBUG-28761 Change-Id: I40d77706851ec24504d6fd8795906dd55249661d Reviewed-by: Qt CI Bot Reviewed-by: Reviewed-by: David Schulz --- src/plugins/texteditor/texteditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 7add698645d..de397c01b4c 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -7638,7 +7638,7 @@ void TextEditorWidget::rewrapParagraph() } // Find end of paragraph. - const QRegularExpression immovableDoxygenCommand(doxygenPrefix + "[@\\\\].*"); + const QRegularExpression immovableDoxygenCommand(doxygenPrefix + "[@\\\\][a-zA-Z]{2,}"); QTC_CHECK(immovableDoxygenCommand.isValid()); while (cursor.movePosition(QTextCursor::NextBlock, QTextCursor::KeepAnchor)) { QString text = cursor.block().text();