Fix handling line separators

BUG: 468977
This commit is contained in:
Tobias Fella
2023-04-28 02:43:29 +02:00
parent 7d2edc7c52
commit 2b06679be6
2 changed files with 10 additions and 0 deletions

View File

@@ -63,6 +63,7 @@ private Q_SLOTS:
void receiveRichEmote();
void receiveRichEdited_data();
void receiveRichEdited();
void receiveLineSeparator();
};
#ifdef QUOTIENT_07
@@ -587,5 +588,13 @@ void TextHandlerTest::receiveRichEdited()
QCOMPARE(testTextHandler.handleRecieveRichText(Qt::RichText, room, room->messageEvents().at(2).get()), testOutputString);
}
void TextHandlerTest::receiveLineSeparator()
{
auto text = QStringLiteral("foo\u2028bar");
TextHandler textHandler;
textHandler.setData(text);
QCOMPARE(textHandler.handleRecievePlainText(Qt::PlainText, true), QStringLiteral("foo bar"));
}
QTEST_MAIN(TextHandlerTest)
#include "texthandlertest.moc"

View File

@@ -213,6 +213,7 @@ QString TextHandler::handleRecievePlainText(Qt::TextFormat inputFormat, const bo
m_dataBuffer.replace(QStringLiteral("<br />\n"), QStringLiteral(" "));
m_dataBuffer.replace(QStringLiteral("<br />"), QStringLiteral(" "));
m_dataBuffer.replace(u'\n', QStringLiteral(" "));
m_dataBuffer.replace(u'\u2028', " ");
}
// Strip all tags/attributes except code blocks which will be escaped.