aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/chat_input
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2023-02-10 14:25:00 +0100
committerfiaxh <git@lightrise.org>2023-02-10 14:25:04 +0100
commitf7750c548abd9f686b12380a7aa852fe3a2a8d1b (patch)
treef6c64dd041a6a0d5d65890a33a3b8446db1d42f6 /main/src/ui/chat_input
parent9bf304095c1acd14e10c499585057695d413ef06 (diff)
downloaddino-f7750c548abd9f686b12380a7aa852fe3a2a8d1b.tar.gz
dino-f7750c548abd9f686b12380a7aa852fe3a2a8d1b.zip
Clear chat input after /command
fixes #1359
Diffstat (limited to 'main/src/ui/chat_input')
-rw-r--r--main/src/ui/chat_input/chat_input_controller.vala15
1 files changed, 8 insertions, 7 deletions
diff --git a/main/src/ui/chat_input/chat_input_controller.vala b/main/src/ui/chat_input/chat_input_controller.vala
index 92a12bc9..d9608a85 100644
--- a/main/src/ui/chat_input/chat_input_controller.vala
+++ b/main/src/ui/chat_input/chat_input_controller.vala
@@ -135,6 +135,12 @@ public class ChatInputController : Object {
}
string text = chat_input.chat_text_view.text_view.buffer.text;
+ ContentItem? quoted_content_item_bak = quoted_content_item;
+
+ // Reset input state. Has do be done before parsing commands, because those directly return.
+ chat_input.chat_text_view.text_view.buffer.text = "";
+ chat_input.unset_quoted_message();
+ quoted_content_item = null;
if (text.has_prefix("/")) {
string[] token = text.split(" ", 2);
@@ -189,15 +195,10 @@ public class ChatInputController : Object {
}
}
Message out_message = stream_interactor.get_module(MessageProcessor.IDENTITY).create_out_message(text, conversation);
- if (quoted_content_item != null) {
- stream_interactor.get_module(Replies.IDENTITY).set_message_is_reply_to(out_message, quoted_content_item);
+ if (quoted_content_item_bak != null) {
+ stream_interactor.get_module(Replies.IDENTITY).set_message_is_reply_to(out_message, quoted_content_item_bak);
}
stream_interactor.get_module(MessageProcessor.IDENTITY).send_message(out_message, conversation);
-
- // Reset input state
- chat_input.chat_text_view.text_view.buffer.text = "";
- chat_input.unset_quoted_message();
- quoted_content_item = null;
}
private void on_text_input_changed() {