mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
Prevent edits from removing quotes at the beginning of a message
This commit is contained in:
parent
b0530089ab
commit
38e3498978
1 changed files with 8 additions and 5 deletions
|
@ -59,11 +59,14 @@ std::string
|
||||||
utils::stripReplyFromBody(const std::string &bodyi)
|
utils::stripReplyFromBody(const std::string &bodyi)
|
||||||
{
|
{
|
||||||
QString body = QString::fromStdString(bodyi);
|
QString body = QString::fromStdString(bodyi);
|
||||||
QRegularExpression plainQuote("^>.*?$\n?", QRegularExpression::MultilineOption);
|
if (body.startsWith("> <")) {
|
||||||
while (body.startsWith(">"))
|
auto segments = body.split('\n');
|
||||||
body.remove(plainQuote);
|
while (!segments.isEmpty() && segments.begin()->startsWith('>'))
|
||||||
if (body.startsWith("\n"))
|
segments.erase(segments.begin());
|
||||||
body.remove(0, 1);
|
if (!segments.empty() && segments.first().isEmpty())
|
||||||
|
segments.erase(segments.begin());
|
||||||
|
body = segments.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
body.replace("@room", QString::fromUtf8("@\u2060room"));
|
body.replace("@room", QString::fromUtf8("@\u2060room"));
|
||||||
return body.toStdString();
|
return body.toStdString();
|
||||||
|
|
Loading…
Reference in a new issue