Fix multi line quotes

This commit is contained in:
James Graham
2026-01-10 17:39:38 +00:00
parent f4cb660422
commit b45ded678e
4 changed files with 2 additions and 4 deletions

View File

@@ -3,7 +3,6 @@
#include "chatkeyhelper.h" #include "chatkeyhelper.h"
#include "chatbarcache.h"
#include "chattextitemhelper.h" #include "chattextitemhelper.h"
#include "clipboard.h" #include "clipboard.h"
#include "neochatroom.h" #include "neochatroom.h"

View File

@@ -75,7 +75,6 @@ QQC2.TextArea {
text: root.editable ? "" : root.display text: root.editable ? "" : root.display
selectByMouse: true selectByMouse: true
persistentSelection: true
readOnly: !root.editable readOnly: !root.editable
textFormat: TextEdit.RichText textFormat: TextEdit.RichText
wrapMode: TextEdit.Wrap wrapMode: TextEdit.Wrap

View File

@@ -87,7 +87,6 @@ TextEdit {
leftPadding: Kirigami.Units.smallSpacing leftPadding: Kirigami.Units.smallSpacing
rightPadding: Kirigami.Units.smallSpacing rightPadding: Kirigami.Units.smallSpacing
persistentSelection: true
text: root.editable ? "" : display text: root.editable ? "" : display

View File

@@ -543,7 +543,7 @@ inline QString formatQuote(const QString &input)
string.removeLast(); string.removeLast();
} }
if (!stringOut.isEmpty()) { if (!stringOut.isEmpty()) {
stringOut += u"\n\n"_s; stringOut += u"\n"_s;
} }
stringOut += u"> "_s + string; stringOut += u"> "_s + string;
} }
@@ -562,6 +562,7 @@ QString ChatBarMessageContentModel::messageText() const
if (MessageComponentType::isTextType(component.type)) { if (MessageComponentType::isTextType(component.type)) {
if (const auto textItem = textItemForComponent(component)) { if (const auto textItem = textItemForComponent(component)) {
auto newText = textItem->markdownText(); auto newText = textItem->markdownText();
newText.replace(QRegularExpression(u"(?<!\n)\n(?!\n)"_s), u" "_s);
if (component.type == MessageComponentType::Quote) { if (component.type == MessageComponentType::Quote) {
newText = formatQuote(newText); newText = formatQuote(newText);
} else if (component.type == MessageComponentType::Code) { } else if (component.type == MessageComponentType::Code) {