From 313bd649dd6cbdd2bf78387aae3674680079fa98 Mon Sep 17 00:00:00 2001
From: Marcus Hoffmann <bubu@bubu1.eu>
Date: Fri, 3 Dec 2021 01:19:09 +0100
Subject: [PATCH] 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
---
 src/timeline/InputBar.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp
index 3e1ab1a10..6e1733a10 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";
-- 
GitLab