From a66046aaf00467fbc8765e3e42dc32c46a95c70a Mon Sep 17 00:00:00 2001
From: Mayeul Cantan <oss+nheko@mayeul.net>
Date: Sat, 31 Oct 2020 23:05:13 +0100
Subject: [PATCH] Allow sending text after `shrug`
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

¯\_(ツ)_/¯ IDK, I like to write something after, sometimes

Allow sending:

¯\_(ツ)_/¯ some text

By entering:

/shrug some text

It's supported in Element. If you did it in nheko, you just used to lose the
extra text.

Not putting text is still supported, a ternary operator makes sure a
space is only inserted if the text isn't empty, to avoid having a trailing
space.
---
 src/TextInputWidget.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/TextInputWidget.cpp b/src/TextInputWidget.cpp
index e6a10f0a4..c23af2c09 100644
--- a/src/TextInputWidget.cpp
+++ b/src/TextInputWidget.cpp
@@ -703,7 +703,7 @@ TextInputWidget::command(QString command, QString args)
         } else if (command == "roomnick") {
                 emit changeRoomNick(args);
         } else if (command == "shrug") {
-                emit sendTextMessage("¯\\_(ツ)_/¯");
+                emit sendTextMessage("¯\\_(ツ)_/¯" + (args.isEmpty() ? "" : " " + args));
         } else if (command == "fliptable") {
                 emit sendTextMessage("(╯°□°)╯︵ ┻━┻");
         } else if (command == "unfliptable") {
-- 
GitLab