From 0ed0495e0aa8f4c170feff0e5e5bd045a9c29191 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sun, 14 May 2023 14:10:51 +0200 Subject: [PATCH] Fix chat input for IME fixes #1419 Co-authored-by: Marvin W --- main/src/ui/chat_input/chat_text_view.vala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main/src/ui/chat_input/chat_text_view.vala b/main/src/ui/chat_input/chat_text_view.vala index 3752a1cf..72ebc845 100644 --- a/main/src/ui/chat_input/chat_text_view.vala +++ b/main/src/ui/chat_input/chat_text_view.vala @@ -94,8 +94,13 @@ public class ChatTextView : Box { } } - private bool on_text_input_key_press(uint keyval, uint keycode, Gdk.ModifierType state) { + private bool on_text_input_key_press(EventControllerKey controller, uint keyval, uint keycode, Gdk.ModifierType state) { if (keyval in new uint[]{ Key.Return, Key.KP_Enter }) { + // Allow the text view to process the event. Needed for IME. + if (text_view.im_context_filter_keypress(controller.get_current_event())) { + return true; + } + if ((state & ModifierType.SHIFT_MASK) > 0) { text_view.buffer.insert_at_cursor("\n", 1); } else if (text_view.buffer.text.strip() != "") {