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