summary refs log tree commit diff
diff options
context:
space:
mode:
authorLordMZTE <lord@mzte.de>2021-03-28 15:36:46 +0200
committerLordMZTE <lord@mzte.de>2021-03-28 15:36:46 +0200
commit6c31bb6ddc88b5eccf2c24b47044da485231d002 (patch)
tree97a61ca1ae4cfa3a973baa4d946be2c02af2b82e
parentcommands now also work with newline after them (diff)
downloadnheko-6c31bb6ddc88b5eccf2c24b47044da485231d002.tar.xz
fix command parsing
-rw-r--r--src/timeline/InputBar.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp
index 2e311169..d7db50a9 100644
--- a/src/timeline/InputBar.cpp
+++ b/src/timeline/InputBar.cpp
@@ -15,6 +15,7 @@
 
 #include <mtx/responses/common.hpp>
 #include <mtx/responses/media.hpp>
+#include <QRegExp>
 
 #include "Cache.h"
 #include "ChatPage.h"
@@ -203,9 +204,7 @@ InputBar::send()
         auto wasEdit = !room->edit().isEmpty();
 
         if (text().startsWith('/')) {
-                int command_end = text().indexOf(' ');
-                if (command_end == -1)
-                        command_end = text().indexOf('\n');
+                int command_end = text().indexOf(QRegExp("\\s+"));
                 if (command_end == -1)
                         command_end = text().size();
                 auto name = text().mid(1, command_end - 1);