diff --git a/docs/iamb.5 b/docs/iamb.5 index 0fdab5f..8357f96 100644 --- a/docs/iamb.5 +++ b/docs/iamb.5 @@ -173,6 +173,9 @@ respective shortcodes. .It Sy message_user_color Defines whether or not the message body is colored like the username. +.It Sy normal_after_send +Defines whether to reset input to Normal mode after sending a message. + .It Sy notifications When this subsection is present, you can enable and configure push notifications. See diff --git a/src/config.rs b/src/config.rs index 99e9490..d998e20 100644 --- a/src/config.rs +++ b/src/config.rs @@ -558,6 +558,7 @@ impl SortOverrides { pub struct TunableValues { pub log_level: Level, pub message_shortcode_display: bool, + pub normal_after_send: bool, pub reaction_display: bool, pub reaction_shortcode_display: bool, pub read_receipt_send: bool, @@ -584,6 +585,7 @@ pub struct TunableValues { pub struct Tunables { pub log_level: Option, pub message_shortcode_display: Option, + pub normal_after_send: Option, pub reaction_display: Option, pub reaction_shortcode_display: Option, pub read_receipt_send: Option, @@ -614,6 +616,7 @@ impl Tunables { message_shortcode_display: self .message_shortcode_display .or(other.message_shortcode_display), + normal_after_send: self.normal_after_send.or(other.normal_after_send), reaction_display: self.reaction_display.or(other.reaction_display), reaction_shortcode_display: self .reaction_shortcode_display @@ -645,6 +648,7 @@ impl Tunables { TunableValues { log_level: self.log_level.map(Level::from).unwrap_or(Level::INFO), message_shortcode_display: self.message_shortcode_display.unwrap_or(false), + normal_after_send: self.normal_after_send.unwrap_or(false), reaction_display: self.reaction_display.unwrap_or(true), reaction_shortcode_display: self.reaction_shortcode_display.unwrap_or(false), read_receipt_send: self.read_receipt_send.unwrap_or(true), diff --git a/src/main.rs b/src/main.rs index c38b239..b0a0eec 100644 --- a/src/main.rs +++ b/src/main.rs @@ -596,6 +596,9 @@ impl Application { None }, IambAction::Send(act) => { + if store.application.settings.tunables.normal_after_send { + self.bindings.reset_mode(); + } self.screen.current_window_mut()?.send_command(act, ctx, store).await? }, diff --git a/src/tests.rs b/src/tests.rs index 3e3f825..73d3e84 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -171,6 +171,7 @@ pub fn mock_tunables() -> TunableValues { default_room: None, log_level: Level::INFO, message_shortcode_display: false, + normal_after_send: true, reaction_display: true, reaction_shortcode_display: false, read_receipt_send: true,