From 7cb809fad248fc3a9def9b7b56b6c75db56a8276 Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Mon, 3 Aug 2026 00:41:49 +0200 Subject: [PATCH] revert all system-user-interruption changes --- gui/chatblockmodel.cpp | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/gui/chatblockmodel.cpp b/gui/chatblockmodel.cpp index 9b70b55..b71eb67 100644 --- a/gui/chatblockmodel.cpp +++ b/gui/chatblockmodel.cpp @@ -193,41 +193,18 @@ QString ChatBlockModel::highlightCode(const QString &code, const QString &langua QString ChatBlockModel::renderMarkdown(const QString &markdown) const { - // Pre-process: render blocks as styled boxes. - // 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; - { - int cursor = 0; - auto it = interruptionRe.globalMatch(markdown); - while (it.hasNext()) { - const auto match = it.next(); - processed += markdown.mid(cursor, match.capturedStart() - cursor); - const QString content = match.captured(1).toHtmlEscaped(); - processed += QStringLiteral( - "
" - "\u26A0\uFE0F User interruption\n") - + content + QStringLiteral("
"); - cursor = match.capturedEnd(); - } - processed += markdown.mid(cursor); - } - static const QRegularExpression fenceRe( R"(```([A-Za-z0-9_+.-]*)[^\n]*\n([\s\S]*?)\n```(\n|$))"); QString result; int cursor = 0; - auto it = fenceRe.globalMatch(processed); + auto it = fenceRe.globalMatch(markdown); while (it.hasNext()) { const auto match = it.next(); // Prose before this fence: HTML-escape and wrap in pre-wrap div to // preserve newlines and whitespace. QTextDocument::setMarkdown would // collapse single newlines (standard Markdown behavior). - const QString prose = processed.mid(cursor, match.capturedStart() - cursor); + const QString prose = markdown.mid(cursor, match.capturedStart() - cursor); if (!prose.isEmpty()) result += QStringLiteral("
") + prose.toHtmlEscaped() + QStringLiteral("
"); @@ -241,7 +218,7 @@ QString ChatBlockModel::renderMarkdown(const QString &markdown) const static const QRegularExpression openFenceRe( R"(^```([A-Za-z0-9_+.-]*)[^\n]*\n([\s\S]*)$)", QRegularExpression::MultilineOption); - const auto tail = processed.mid(cursor); + const auto tail = markdown.mid(cursor); if (!tail.isEmpty()) { const auto open = openFenceRe.match(tail); if (open.hasMatch()) {