Add option to disable recover mode

Use `config.general.disable_recover_mode = true` to disable the recover
mode.

Closes: https://github.com/sayanarijit/xplr/issues/232
pull/237/head
Arijit Basu 3 years ago committed by Arijit Basu
parent a2f42ac6fc
commit 1513c325d6

@ -1775,12 +1775,16 @@ impl App {
})
.or_else(|| default.map(|a| a.messages().clone()))
.unwrap_or_else(|| {
vec![
ExternalMsg::SwitchModeBuiltin("recover".into()),
ExternalMsg::LogWarning(
"Key map not found. Let's calm down, escape, and try again.".into(),
),
]
if self.config().general().disable_recover_mode() {
vec![ExternalMsg::LogWarning("Key map not found.".into())]
} else {
vec![
ExternalMsg::SwitchModeBuiltin("recover".into()),
ExternalMsg::LogWarning(
"Key map not found. Let's calm down, escape, and try again.".into(),
),
]
}
});
for msg in msgs {

@ -445,6 +445,9 @@ pub struct GeneralConfig {
#[serde(default)]
pub read_only: bool,
#[serde(default)]
pub disable_recover_mode: bool,
#[serde(default)]
pub cursor: UiElement,
@ -557,6 +560,11 @@ impl GeneralConfig {
pub fn enable_mouse(&self) -> bool {
self.enable_mouse
}
/// Get a reference to the general config's disable recover mode.
pub fn disable_recover_mode(&self) -> bool {
self.disable_recover_mode
}
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]

Loading…
Cancel
Save