Commit 0ff8828a1c

0ff8828a1c6dd944edcaa68bdab859e89d626e6b

parent: 331a6bca89

Unregistered key

vaw <git@nlih.de> · 2025-07-23 04:05 UTC
committer: <noreply@github.com>

Add config option to allow resetting mode after sending a message (#459)

Co-authored-by: Ulyssa <git@ulyssa.dev>

Layout: unified · split

docs/iamb.5 +3
@@ -173,6 +173,9 @@ respective shortcodes.
173.It Sy message_user_color 173.It Sy message_user_color
174Defines whether or not the message body is colored like the username. 174Defines whether or not the message body is colored like the username.
175 175
176.It Sy normal_after_send
177Defines whether to reset input to Normal mode after sending a message.
178
176.It Sy notifications 179.It Sy notifications
177When this subsection is present, you can enable and configure push notifications. 180When this subsection is present, you can enable and configure push notifications.
178See 181See
src/config.rs +4
@@ -558,6 +558,7 @@ impl SortOverrides {
558pub struct TunableValues { 558pub struct TunableValues {
559 pub log_level: Level, 559 pub log_level: Level,
560 pub message_shortcode_display: bool, 560 pub message_shortcode_display: bool,
561 pub normal_after_send: bool,
561 pub reaction_display: bool, 562 pub reaction_display: bool,
562 pub reaction_shortcode_display: bool, 563 pub reaction_shortcode_display: bool,
563 pub read_receipt_send: bool, 564 pub read_receipt_send: bool,
@@ -584,6 +585,7 @@ pub struct TunableValues {
584pub struct Tunables { 585pub struct Tunables {
585 pub log_level: Option<LogLevel>, 586 pub log_level: Option<LogLevel>,
586 pub message_shortcode_display: Option<bool>, 587 pub message_shortcode_display: Option<bool>,
588 pub normal_after_send: Option<bool>,
587 pub reaction_display: Option<bool>, 589 pub reaction_display: Option<bool>,
588 pub reaction_shortcode_display: Option<bool>, 590 pub reaction_shortcode_display: Option<bool>,
589 pub read_receipt_send: Option<bool>, 591 pub read_receipt_send: Option<bool>,
@@ -614,6 +616,7 @@ impl Tunables {
614 message_shortcode_display: self 616 message_shortcode_display: self
615 .message_shortcode_display 617 .message_shortcode_display
616 .or(other.message_shortcode_display), 618 .or(other.message_shortcode_display),
619 normal_after_send: self.normal_after_send.or(other.normal_after_send),
617 reaction_display: self.reaction_display.or(other.reaction_display), 620 reaction_display: self.reaction_display.or(other.reaction_display),
618 reaction_shortcode_display: self 621 reaction_shortcode_display: self
619 .reaction_shortcode_display 622 .reaction_shortcode_display
@@ -645,6 +648,7 @@ impl Tunables {
645 TunableValues { 648 TunableValues {
646 log_level: self.log_level.map(Level::from).unwrap_or(Level::INFO), 649 log_level: self.log_level.map(Level::from).unwrap_or(Level::INFO),
647 message_shortcode_display: self.message_shortcode_display.unwrap_or(false), 650 message_shortcode_display: self.message_shortcode_display.unwrap_or(false),
651 normal_after_send: self.normal_after_send.unwrap_or(false),
648 reaction_display: self.reaction_display.unwrap_or(true), 652 reaction_display: self.reaction_display.unwrap_or(true),
649 reaction_shortcode_display: self.reaction_shortcode_display.unwrap_or(false), 653 reaction_shortcode_display: self.reaction_shortcode_display.unwrap_or(false),
650 read_receipt_send: self.read_receipt_send.unwrap_or(true), 654 read_receipt_send: self.read_receipt_send.unwrap_or(true),
src/main.rs +3
@@ -596,6 +596,9 @@ impl Application {
596 None 596 None
597 }, 597 },
598 IambAction::Send(act) => { 598 IambAction::Send(act) => {
599 if store.application.settings.tunables.normal_after_send {
600 self.bindings.reset_mode();
601 }
599 self.screen.current_window_mut()?.send_command(act, ctx, store).await? 602 self.screen.current_window_mut()?.send_command(act, ctx, store).await?
600 }, 603 },
601 604
src/tests.rs +1
@@ -171,6 +171,7 @@ pub fn mock_tunables() -> TunableValues {
171 default_room: None, 171 default_room: None,
172 log_level: Level::INFO, 172 log_level: Level::INFO,
173 message_shortcode_display: false, 173 message_shortcode_display: false,
174 normal_after_send: true,
174 reaction_display: true, 175 reaction_display: true,
175 reaction_shortcode_display: false, 176 reaction_shortcode_display: false,
176 read_receipt_send: true, 177 read_receipt_send: true,