Clear chat input after /command

fixes #1359
This commit is contained in:
fiaxh 2023-02-10 14:25:00 +01:00
parent 9bf304095c
commit f7750c548a

View file

@ -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() {