mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
feat!: make backspace command not close the input even when value is empty (#1680)
This commit is contained in:
parent
e1773b11f1
commit
a96c60ce6a
2 changed files with 1 additions and 5 deletions
|
|
@ -232,7 +232,7 @@ keymap = [
|
||||||
{ on = "<End>", run = "move 999", desc = "Move to the EOL" },
|
{ on = "<End>", run = "move 999", desc = "Move to the EOL" },
|
||||||
|
|
||||||
# Delete
|
# Delete
|
||||||
{ on = "<Backspace>", run = "backspace", desc = "Delete the character before the cursor" },
|
{ on = "<Backspace>", run = "backspace", desc = "Delete the character before the cursor" },
|
||||||
{ on = "<Delete>", run = "backspace --under", desc = "Delete the character under the cursor" },
|
{ on = "<Delete>", run = "backspace --under", desc = "Delete the character under the cursor" },
|
||||||
{ on = "<C-h>", run = "backspace", desc = "Delete the character before the cursor" },
|
{ on = "<C-h>", run = "backspace", desc = "Delete the character before the cursor" },
|
||||||
{ on = "<C-d>", run = "backspace --under", desc = "Delete the character under the cursor" },
|
{ on = "<C-d>", run = "backspace --under", desc = "Delete the character under the cursor" },
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,6 @@ impl From<bool> for Opt {
|
||||||
impl Input {
|
impl Input {
|
||||||
pub fn backspace(&mut self, opt: impl Into<Opt>) {
|
pub fn backspace(&mut self, opt: impl Into<Opt>) {
|
||||||
let snap = self.snaps.current_mut();
|
let snap = self.snaps.current_mut();
|
||||||
if snap.value.is_empty() {
|
|
||||||
return self.close(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
let opt = opt.into() as Opt;
|
let opt = opt.into() as Opt;
|
||||||
if !opt.under && snap.cursor < 1 {
|
if !opt.under && snap.cursor < 1 {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue