commit c4b56a48af9240be02e9761b16d67cdbee5d44c6
parent d0be18c80e764c274bdadae4c3e24227891df473
Author: William Casarin <jb55@jb55.com>
Date: Mon, 10 Feb 2025 16:44:52 -0800
Merge ctrl-enter to post
Ethan Tuttle (1):
feat: ctrl+enter when creating a new note, sends the note, the same way clicking the "Post Now" button.
Diffstat:
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
@@ -332,12 +332,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 output = self.draft.buffer.output();
let new_post = NewPost::new(