From a96c60ce6af16c48d1397aac9bb20f596f56f4c2 Mon Sep 17 00:00:00 2001 From: XYenon Date: Thu, 3 Oct 2024 07:41:28 +0800 Subject: [PATCH] feat!: make `backspace` command not close the input even when value is empty (#1680) --- yazi-config/preset/keymap.toml | 2 +- yazi-core/src/input/commands/backspace.rs | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/yazi-config/preset/keymap.toml b/yazi-config/preset/keymap.toml index f6dc8d1e..3236ebaf 100644 --- a/yazi-config/preset/keymap.toml +++ b/yazi-config/preset/keymap.toml @@ -232,7 +232,7 @@ keymap = [ { on = "", run = "move 999", desc = "Move to the EOL" }, # Delete - { on = "", run = "backspace", desc = "Delete the character before the cursor" }, + { on = "", run = "backspace", desc = "Delete the character before the cursor" }, { on = "", run = "backspace --under", desc = "Delete the character under the cursor" }, { on = "", run = "backspace", desc = "Delete the character before the cursor" }, { on = "", run = "backspace --under", desc = "Delete the character under the cursor" }, diff --git a/yazi-core/src/input/commands/backspace.rs b/yazi-core/src/input/commands/backspace.rs index 37b0e5ac..2b88ceb7 100644 --- a/yazi-core/src/input/commands/backspace.rs +++ b/yazi-core/src/input/commands/backspace.rs @@ -16,10 +16,6 @@ impl From for Opt { impl Input { pub fn backspace(&mut self, opt: impl Into) { let snap = self.snaps.current_mut(); - if snap.value.is_empty() { - return self.close(false); - } - let opt = opt.into() as Opt; if !opt.under && snap.cursor < 1 { return;