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

Co-authored-by: Ulyssa <git@ulyssa.dev>
This commit is contained in:
vaw 2025-07-23 04:05:40 +00:00 committed by GitHub
parent 331a6bca89
commit 0ff8828a1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 0 deletions

View file

@ -173,6 +173,9 @@ respective shortcodes.
.It Sy message_user_color .It Sy message_user_color
Defines whether or not the message body is colored like the username. 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 .It Sy notifications
When this subsection is present, you can enable and configure push notifications. When this subsection is present, you can enable and configure push notifications.
See See

View file

@ -558,6 +558,7 @@ impl SortOverrides {
pub struct TunableValues { pub struct TunableValues {
pub log_level: Level, pub log_level: Level,
pub message_shortcode_display: bool, pub message_shortcode_display: bool,
pub normal_after_send: bool,
pub reaction_display: bool, pub reaction_display: bool,
pub reaction_shortcode_display: bool, pub reaction_shortcode_display: bool,
pub read_receipt_send: bool, pub read_receipt_send: bool,
@ -584,6 +585,7 @@ pub struct TunableValues {
pub struct Tunables { pub struct Tunables {
pub log_level: Option<LogLevel>, pub log_level: Option<LogLevel>,
pub message_shortcode_display: Option<bool>, pub message_shortcode_display: Option<bool>,
pub normal_after_send: Option<bool>,
pub reaction_display: Option<bool>, pub reaction_display: Option<bool>,
pub reaction_shortcode_display: Option<bool>, pub reaction_shortcode_display: Option<bool>,
pub read_receipt_send: Option<bool>, pub read_receipt_send: Option<bool>,
@ -614,6 +616,7 @@ impl Tunables {
message_shortcode_display: self message_shortcode_display: self
.message_shortcode_display .message_shortcode_display
.or(other.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_display: self.reaction_display.or(other.reaction_display),
reaction_shortcode_display: self reaction_shortcode_display: self
.reaction_shortcode_display .reaction_shortcode_display
@ -645,6 +648,7 @@ impl Tunables {
TunableValues { TunableValues {
log_level: self.log_level.map(Level::from).unwrap_or(Level::INFO), log_level: self.log_level.map(Level::from).unwrap_or(Level::INFO),
message_shortcode_display: self.message_shortcode_display.unwrap_or(false), 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_display: self.reaction_display.unwrap_or(true),
reaction_shortcode_display: self.reaction_shortcode_display.unwrap_or(false), reaction_shortcode_display: self.reaction_shortcode_display.unwrap_or(false),
read_receipt_send: self.read_receipt_send.unwrap_or(true), read_receipt_send: self.read_receipt_send.unwrap_or(true),

View file

@ -596,6 +596,9 @@ impl Application {
None None
}, },
IambAction::Send(act) => { 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? self.screen.current_window_mut()?.send_command(act, ctx, store).await?
}, },

View file

@ -171,6 +171,7 @@ pub fn mock_tunables() -> TunableValues {
default_room: None, default_room: None,
log_level: Level::INFO, log_level: Level::INFO,
message_shortcode_display: false, message_shortcode_display: false,
normal_after_send: true,
reaction_display: true, reaction_display: true,
reaction_shortcode_display: false, reaction_shortcode_display: false,
read_receipt_send: true, read_receipt_send: true,