From e3150798d917ab30c9d110c85b9b0174c861a80e Mon Sep 17 00:00:00 2001 From: Arijit Basu Date: Mon, 27 Sep 2021 18:11:29 +0530 Subject: [PATCH] Disable recover mode by default Closes: https://github.com/sayanarijit/xplr/issues/330 --- docs/en/src/general-config.md | 7 +++---- src/app.rs | 6 +++--- src/config.rs | 8 ++++---- src/init.lua | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/docs/en/src/general-config.md b/docs/en/src/general-config.md index e158cb8..5645fea 100644 --- a/docs/en/src/general-config.md +++ b/docs/en/src/general-config.md @@ -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 diff --git a/src/app.rs b/src/app.rs index 0dbf4d0..964b228 100644 --- a/src/app.rs +++ b/src/app.rs @@ -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())] } }); diff --git a/src/config.rs b/src/config.rs index b9f0ff5..397aea4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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. diff --git a/src/init.lua b/src/init.lua index 818f47a..1600cd7 100644 --- a/src/init.lua +++ b/src/init.lua @@ -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