From f7750c548abd9f686b12380a7aa852fe3a2a8d1b Mon Sep 17 00:00:00 2001 From: fiaxh Date: Fri, 10 Feb 2023 14:25:00 +0100 Subject: [PATCH] Clear chat input after /command fixes #1359 --- main/src/ui/chat_input/chat_input_controller.vala | 15 ++++++++------- 1 file 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() {