mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
InputBar: use multi-arg string replacement
This could actually change the behaviour here (could, because I don't know if we can hit this special case) but this should hopefully the correct way of doing this. There's some detailed explanation of the difference here: https://doc.qt.io/qt-5/qstring.html#arg-14 > This is the same as str.arg(a1).arg(a2), except that the strings > a1 and a2 are replaced in one pass. This can make a difference if > a1 contains e.g. %1: ``` QString str; str = "%1 %2"; str.arg("%1f", "Hello"); // returns "%1f Hello" str.arg("%1f").arg("Hello"); // returns "Hellof %2" ``` Suggested-by: Clazy: Use multi-arg instead
This commit is contained in:
parent
02aa87590b
commit
313bd649dd
1 changed files with 2 additions and 2 deletions
|
@ -324,13 +324,13 @@ InputBar::message(const QString& msg, MarkdownOverride useMarkdown, bool rainbow
|
||||||
for (const auto &line : related.quoted_body.split("\n")) {
|
for (const auto &line : related.quoted_body.split("\n")) {
|
||||||
if (firstLine) {
|
if (firstLine) {
|
||||||
firstLine = false;
|
firstLine = false;
|
||||||
body = QString("> <%1> %2\n").arg(related.quoted_user).arg(line);
|
body = QString("> <%1> %2\n").arg(related.quoted_user, line);
|
||||||
} else {
|
} else {
|
||||||
body += QString("> %1\n").arg(line);
|
body += QString("> %1\n").arg(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
text.body = QString("%1\n%2").arg(body).arg(msg).toStdString();
|
text.body = QString("%1\n%2").arg(body, msg).toStdString();
|
||||||
|
|
||||||
// NOTE(Nico): rich replies always need a formatted_body!
|
// NOTE(Nico): rich replies always need a formatted_body!
|
||||||
text.format = "org.matrix.custom.html";
|
text.format = "org.matrix.custom.html";
|
||||||
|
|
Loading…
Reference in a new issue