Commit be3d27d4e6
Unregistered key
Layout: unified · split
docs/iamb.5 +4
| @@ -272,6 +272,10 @@ A message must be sent to the room before marking it read. | |||
| 272 | Defines whether or not read confirmations are displayed. | 272 | Defines whether or not read confirmations are displayed. |
| 273 | .It Sy request_timeout | 273 | .It Sy request_timeout |
| 274 | Defines the maximum time per request in seconds. | 274 | Defines the maximum time per request in seconds. |
| 275 | .It Sy send_on_enter | ||
| 276 | If | ||
| 277 | .Sy true | ||
| 278 | (the default), pressing enter in insert mode will send the message instead of inserting a linebreak. | ||
| 275 | .It Sy sort | 279 | .It Sy sort |
| 276 | Configures how to sort the lists shown in windows like | 280 | Configures how to sort the lists shown in windows like |
| 277 | .Sy :rooms | 281 | .Sy :rooms |
src/config.rs +4
| @@ -872,6 +872,7 @@ pub struct TunableValues { | |||
| 872 | pub default_split: SplitDirection, | 872 | pub default_split: SplitDirection, |
| 873 | pub ssl_verify: bool, | 873 | pub ssl_verify: bool, |
| 874 | pub cache_policy: MediaRetentionPolicy, | 874 | pub cache_policy: MediaRetentionPolicy, |
| 875 | pub send_on_enter: bool, | ||
| 875 | } | 876 | } |
| 876 | 877 | ||
| 877 | #[derive(Clone, Debug, Default, Deserialize)] | 878 | #[derive(Clone, Debug, Default, Deserialize)] |
| @@ -928,6 +929,7 @@ pub struct Tunables { | |||
| 928 | pub default_split: Option<SplitDirection>, | 929 | pub default_split: Option<SplitDirection>, |
| 929 | pub ssl_verify: Option<bool>, | 930 | pub ssl_verify: Option<bool>, |
| 930 | pub cache_policy: Option<MediaRetentionPolicy>, | 931 | pub cache_policy: Option<MediaRetentionPolicy>, |
| 932 | pub send_on_enter: Option<bool>, | ||
| 931 | } | 933 | } |
| 932 | 934 | ||
| 933 | impl Tunables { | 935 | impl Tunables { |
| @@ -982,6 +984,7 @@ impl Tunables { | |||
| 982 | default_split: self.default_split.or(other.default_split), | 984 | default_split: self.default_split.or(other.default_split), |
| 983 | ssl_verify: self.ssl_verify.or(other.ssl_verify), | 985 | ssl_verify: self.ssl_verify.or(other.ssl_verify), |
| 984 | cache_policy: self.cache_policy.or(other.cache_policy), | 986 | cache_policy: self.cache_policy.or(other.cache_policy), |
| 987 | send_on_enter: self.send_on_enter.or(other.send_on_enter), | ||
| 985 | } | 988 | } |
| 986 | } | 989 | } |
| 987 | 990 | ||
| @@ -1028,6 +1031,7 @@ impl Tunables { | |||
| 1028 | default_split: self.default_split.unwrap_or_default(), | 1031 | default_split: self.default_split.unwrap_or_default(), |
| 1029 | ssl_verify: self.ssl_verify.unwrap_or(true), | 1032 | ssl_verify: self.ssl_verify.unwrap_or(true), |
| 1030 | cache_policy: self.cache_policy.unwrap_or_default(), | 1033 | cache_policy: self.cache_policy.unwrap_or_default(), |
| 1034 | send_on_enter: self.send_on_enter.unwrap_or(true), | ||
| 1031 | } | 1035 | } |
| 1032 | } | 1036 | } |
| 1033 | } | 1037 | } |
src/keybindings.rs +3 −3
| @@ -9,7 +9,7 @@ use modalkit::env::vim::keybindings::{InputStep, VimBindings}; | |||
| 9 | use modalkit::keybindings::{EdgeEvent, EdgeRepeat, InputBindings}; | 9 | use modalkit::keybindings::{EdgeEvent, EdgeRepeat, InputBindings}; |
| 10 | 10 | ||
| 11 | use crate::base::{Keybindings, MATRIX_ID_WORD}; | 11 | use crate::base::{Keybindings, MATRIX_ID_WORD}; |
| 12 | use crate::config::{Keys, SplitDirection}; | 12 | use crate::config::{Keys, SplitDirection, TunableValues}; |
| 13 | use crate::prelude::*; | 13 | use crate::prelude::*; |
| 14 | 14 | ||
| 15 | pub type IambStep = InputStep<IambInfo>; | 15 | pub type IambStep = InputStep<IambInfo>; |
| @@ -19,11 +19,11 @@ fn once(key: &TerminalKey) -> (EdgeRepeat, EdgeEvent<TerminalKey, CommonKeyClass | |||
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | /// Initialize the default keybinding state. | 21 | /// Initialize the default keybinding state. |
| 22 | pub fn setup_keybindings() -> Keybindings { | 22 | pub fn setup_keybindings(tunables: &TunableValues) -> Keybindings { |
| 23 | let mut ism = Keybindings::empty(); | 23 | let mut ism = Keybindings::empty(); |
| 24 | 24 | ||
| 25 | let vim = VimBindings::default() | 25 | let vim = VimBindings::default() |
| 26 | .submit_on_enter(false) | 26 | .submit_on_enter(!tunables.send_on_enter) |
| 27 | .cursor_open(MATRIX_ID_WORD.clone()); | 27 | .cursor_open(MATRIX_ID_WORD.clone()); |
| 28 | 28 | ||
| 29 | vim.setup(&mut ism); | 29 | vim.setup(&mut ism); |
src/main.rs +1 −1
| @@ -288,7 +288,7 @@ impl Application { | |||
| 288 | let backend = CrosstermBackend::new(stdout()); | 288 | let backend = CrosstermBackend::new(stdout()); |
| 289 | let terminal = Terminal::new(backend)?; | 289 | let terminal = Terminal::new(backend)?; |
| 290 | 290 | ||
| 291 | let mut bindings = crate::keybindings::setup_keybindings(); | 291 | let mut bindings = crate::keybindings::setup_keybindings(&settings.tunables); |
| 292 | settings.setup(&mut bindings); | 292 | settings.setup(&mut bindings); |
| 293 | let bindings = KeyManager::new(bindings); | 293 | let bindings = KeyManager::new(bindings); |
| 294 | 294 | ||
src/tests.rs +1
| @@ -201,6 +201,7 @@ pub fn mock_tunables() -> TunableValues { | |||
| 201 | default_split: Default::default(), | 201 | default_split: Default::default(), |
| 202 | ssl_verify: true, | 202 | ssl_verify: true, |
| 203 | cache_policy: Default::default(), | 203 | cache_policy: Default::default(), |
| 204 | send_on_enter: true, | ||
| 204 | } | 205 | } |
| 205 | } | 206 | } |
| 206 | 207 | ||