diff options
author | fiaxh <git@lightrise.org> | 2020-04-05 16:19:56 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2020-04-05 16:19:56 +0200 |
commit | d091a6c3cd0812873bcdef53c51a2f60e12f2b8a (patch) | |
tree | d350880657a77e04a777a4d6072b5951c7cd58c0 /main/src/ui/chat_input | |
parent | 8f7595418890cc2dac62dc4903405c49e61176d2 (diff) | |
download | dino-d091a6c3cd0812873bcdef53c51a2f60e12f2b8a.tar.gz dino-d091a6c3cd0812873bcdef53c51a2f60e12f2b8a.zip |
Add keyboard shortcut (up key) to activate last message correction
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; + } } } |