aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/chat_input
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-04-05 16:19:56 +0200
committerfiaxh <git@lightrise.org>2020-04-05 16:19:56 +0200
commitd091a6c3cd0812873bcdef53c51a2f60e12f2b8a (patch)
treed350880657a77e04a777a4d6072b5951c7cd58c0 /main/src/ui/chat_input
parent8f7595418890cc2dac62dc4903405c49e61176d2 (diff)
downloaddino-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.vala13
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;
+ }
}
}