diff --git a/gui/chatblockmodel.cpp b/gui/chatblockmodel.cpp index f93c1a9..9b70b55 100644 --- a/gui/chatblockmodel.cpp +++ b/gui/chatblockmodel.cpp @@ -194,28 +194,26 @@ QString ChatBlockModel::highlightCode(const QString &code, const QString &langua QString ChatBlockModel::renderMarkdown(const QString &markdown) const { // Pre-process: render blocks as styled boxes. - // These appear as prose between code fences (the server closes the tool - // output fence before the interruption and reopens it after). + // Manual global-match loop instead of replace-with-lambda, which requires + // Qt 6.5+ and isn't available on all target systems. static const QRegularExpression interruptionRe( R"(\n([\s\S]*?)\n)"); - QString processed = markdown; + QString processed; { int cursor = 0; - QString rebuilt; auto it = interruptionRe.globalMatch(markdown); while (it.hasNext()) { const auto match = it.next(); - rebuilt += markdown.mid(cursor, match.capturedStart() - cursor); + processed += markdown.mid(cursor, match.capturedStart() - cursor); const QString content = match.captured(1).toHtmlEscaped(); - rebuilt += QStringLiteral( + processed += QStringLiteral( "
" "\u26A0\uFE0F User interruption\n") + content + QStringLiteral("
"); cursor = match.capturedEnd(); } - rebuilt += markdown.mid(cursor); - processed = rebuilt; + processed += markdown.mid(cursor); } static const QRegularExpression fenceRe(