From 2f1f04b3e80beaf2c7f333a14cb7e14eeafe935e Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Mon, 18 Sep 2023 23:15:06 +0200 Subject: Make send button settings-selectable --- main/src/ui/chat_input/chat_text_view.vala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'main/src/ui/chat_input/chat_text_view.vala') diff --git a/main/src/ui/chat_input/chat_text_view.vala b/main/src/ui/chat_input/chat_text_view.vala index 6b85b082..0bfb41a9 100644 --- a/main/src/ui/chat_input/chat_text_view.vala +++ b/main/src/ui/chat_input/chat_text_view.vala @@ -76,8 +76,11 @@ public class ChatTextView : ScrolledWindow { private bool on_text_input_key_press(EventKey event) { if (event.keyval in new uint[]{Key.Return, Key.KP_Enter}) { - if ((event.state & ModifierType.CONTROL_MASK) > 0) { - text_view.buffer.insert_at_cursor("\n", 1); + Dino.Entities.Settings settings = Dino.Application.get_default().settings; + + if ((event.state & ModifierType.SHIFT_MASK) > 0 + || settings.enter_newline) { + text_view.buffer.insert_at_cursor("\n", 1); } else if (text_view.buffer.text.strip() != "") { send_text(); edit_history.reset_history(); -- cgit v1.2.3