mirror of
https://github.com/youwen5/iamb.git
synced 2025-08-04 03:28:28 -07:00
Add config option to allow resetting mode after sending a message (#459)
Co-authored-by: Ulyssa <git@ulyssa.dev>
This commit is contained in:
parent
331a6bca89
commit
0ff8828a1c
4 changed files with 11 additions and 0 deletions
|
@ -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<LogLevel>,
|
||||
pub message_shortcode_display: Option<bool>,
|
||||
pub normal_after_send: Option<bool>,
|
||||
pub reaction_display: Option<bool>,
|
||||
pub reaction_shortcode_display: Option<bool>,
|
||||
pub read_receipt_send: Option<bool>,
|
||||
|
@ -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),
|
||||
|
|
|
@ -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?
|
||||
},
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue