diff options
Diffstat (limited to 'main/src/ui/chat_input')
-rw-r--r-- | main/src/ui/chat_input/chat_input_controller.vala | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/main/src/ui/chat_input/chat_input_controller.vala b/main/src/ui/chat_input/chat_input_controller.vala index c0878c36..4844ff6c 100644 --- a/main/src/ui/chat_input/chat_input_controller.vala +++ b/main/src/ui/chat_input/chat_input_controller.vala @@ -8,6 +8,8 @@ namespace Dino.Ui { public class ChatInputController : Object { + public signal void activate_last_message_correction(); + public new string? conversation_display_name { get; set; } public string? conversation_topic { get; set; } @@ -30,6 +32,7 @@ public class ChatInputController : Object { reset_input_field_status(); chat_input.chat_text_view.text_view.buffer.changed.connect(on_text_input_changed); + chat_input.chat_text_view.text_view.key_press_event.connect(on_text_input_key_press); chat_text_view_controller.send_text.connect(send_text); chat_input.encryption_widget.encryption_changed.connect(on_encryption_changed); @@ -145,6 +148,16 @@ public class ChatInputController : Object { stream_interactor.get_module(ChatInteraction.IDENTITY).on_message_cleared(conversation); } } + + private bool on_text_input_key_press(EventKey event) { + if (event.keyval == Gdk.Key.Up && chat_input.chat_text_view.text_view.buffer.text == "") { + activate_last_message_correction(); + return true; + } else { + chat_input.chat_text_view.text_view.grab_focus(); + } + return false; + } } } |