Disable recover mode by default

Closes: https://github.com/sayanarijit/xplr/issues/330
This commit is contained in:
Arijit Basu 2021-09-27 18:11:29 +05:30 committed by Arijit Basu
parent bb5dcff0bf
commit e3150798d9
4 changed files with 11 additions and 12 deletions

View File

@ -30,14 +30,13 @@ Set it to `true` to use only a subset of selected operations that forbids
executing commands or performing write operations on the file-system.
disable_recover_mode
enable_recover_mode
--------------------
Type: boolean
Set it to `true` when the special recover mode gets too annoying to appreciate
the good intentions. When enabled, typing the wrong keys won't result in any
action.
Set it to `true` if you want to enable a safety feature that will save you from
yourself when you type recklessly.
cursor.format

View File

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

View File

@ -446,7 +446,7 @@ pub struct GeneralConfig {
pub read_only: bool,
#[serde(default)]
pub disable_recover_mode: bool,
pub enable_recover_mode: bool,
#[serde(default)]
pub cursor: UiElement,
@ -567,9 +567,9 @@ impl GeneralConfig {
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
/// Get a reference to the general config's enable recover mode.
pub fn enable_recover_mode(&self) -> bool {
self.enable_recover_mode
}
/// Set the general config's read only.

View File

@ -14,7 +14,7 @@ xplr.config.general.show_hidden = false
xplr.config.general.read_only = false
------ Recover mode
xplr.config.general.disable_recover_mode = false
xplr.config.general.enable_recover_mode = false
------ Start FIFO
xplr.config.general.start_fifo = nil