summary refs log tree commit diff
path: root/src/timeline/InputBar.cpp
diff options
context:
space:
mode:
authorMarcus Hoffmann <bubu@bubu1.eu>2021-12-03 01:19:09 +0100
committerMarcus Hoffmann <bubu@bubu1.eu>2021-12-03 01:37:00 +0100
commit313bd649dd6cbdd2bf78387aae3674680079fa98 (patch)
tree310de40038f383300164a82904f7942f7f5230ce /src/timeline/InputBar.cpp
parentInputBar: use character argument instead of string (diff)
downloadnheko-313bd649dd6cbdd2bf78387aae3674680079fa98.tar.xz
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
Diffstat (limited to 'src/timeline/InputBar.cpp')
-rw-r--r--src/timeline/InputBar.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp

index 3e1ab1a1..6e1733a1 100644 --- a/src/timeline/InputBar.cpp +++ b/src/timeline/InputBar.cpp
@@ -324,13 +324,13 @@ InputBar::message(const QString& msg, MarkdownOverride useMarkdown, bool rainbow for (const auto &line : related.quoted_body.split("\n")) { if (firstLine) { firstLine = false; - body = QString("> <%1> %2\n").arg(related.quoted_user).arg(line); + body = QString("> <%1> %2\n").arg(related.quoted_user, line); } else { 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! text.format = "org.matrix.custom.html";