Treat all text in a code block as plain, i.e. don't format based on markdown.

This commit is contained in:
James Graham
2026-02-27 13:30:30 +00:00
parent e0b229e040
commit daa66c4abc

View File

@@ -5,6 +5,7 @@
#include <QTextCursor>
#include <QTextDocument>
#include <qnamespace.h>
#include <qtextcursor.h>
#include "chattextitemhelper.h"
@@ -188,7 +189,7 @@ void ChatMarkdownHelper::checkMarkdown(int position, int charsRemoved, int chars
// This can happen when formatting is applied.
if (charsAdded == charsRemoved) {
return;
} else if (m_textItem->isCompleting || charsRemoved > charsAdded || charsAdded - charsRemoved > 1) {
} else if ((m_textItem->textFormat() && m_textItem->textFormat() == Qt::TextFormat::PlainText) || m_textItem->isCompleting || charsRemoved > charsAdded || charsAdded - charsRemoved > 1) {
updatePosition(std::max(0, position - charsRemoved + charsAdded));
return;
}