From 8aaaa336e2097f7d780f6b676d495ec4dfcfccd3 Mon Sep 17 00:00:00 2001 From: Ethan Tuttle Date: Sat, 8 Feb 2025 21:48:00 -0500 Subject: [PATCH] feat: ctrl+enter when creating a new note, sends the note, the same way clicking the "Post Now" button. This button combination is common enough in "power user" apps for multiline input that I think this is a good default and could likely be configurable in the future. --- crates/notedeck_columns/src/ui/note/post.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/notedeck_columns/src/ui/note/post.rs b/crates/notedeck_columns/src/ui/note/post.rs index 020677b1..b86f952f 100644 --- a/crates/notedeck_columns/src/ui/note/post.rs +++ b/crates/notedeck_columns/src/ui/note/post.rs @@ -227,12 +227,18 @@ impl<'a> PostView<'a> { ); ui.with_layout(egui::Layout::right_to_left(egui::Align::BOTTOM), |ui| { - if ui + let post_button_clicked = ui .add_sized( [91.0, 32.0], post_button(!self.draft.buffer.is_empty()), ) - .clicked() + .clicked(); + + let ctrl_enter_pressed = ui + .input(|i| i.modifiers.ctrl && i.key_pressed(egui::Key::Enter)); + + if post_button_clicked + || (!self.draft.buffer.is_empty() && ctrl_enter_pressed) { let new_post = NewPost::new( self.draft.buffer.clone(),