mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01:05 +00:00
fix: use <Tab> for completion confirming to avoid conflicts with the Input component
This commit is contained in:
parent
1f744810f4
commit
7c49d9c57a
3 changed files with 29 additions and 25 deletions
|
|
@ -217,6 +217,21 @@ keymap = [
|
|||
{ on = [ "~" ], exec = "help", desc = "Open help" }
|
||||
]
|
||||
|
||||
[completion]
|
||||
|
||||
keymap = [
|
||||
{ on = [ "<C-q>" ], exec = "close", desc = "Cancel completion" },
|
||||
{ on = [ "<Tab>" ], exec = "close --submit", desc = "Submit the completion" },
|
||||
|
||||
{ on = [ "<A-k>" ], exec = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [ "<A-j>" ], exec = "arrow 1", desc = "Move cursor down" },
|
||||
|
||||
{ on = [ "<Up>" ], exec = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [ "<Down>" ], exec = "arrow 1", desc = "Move cursor down" },
|
||||
|
||||
{ on = [ "~" ], exec = "help", desc = "Open help" }
|
||||
]
|
||||
|
||||
[help]
|
||||
|
||||
keymap = [
|
||||
|
|
@ -237,18 +252,3 @@ keymap = [
|
|||
# Filtering
|
||||
{ on = [ "/" ], exec = "filter", desc = "Apply a filter for the help items" },
|
||||
]
|
||||
|
||||
[completion]
|
||||
|
||||
keymap = [
|
||||
{ on = [ "<C-q>" ], exec = "close", desc = "Cancel completion" },
|
||||
{ on = [ "<Enter>" ], exec = "close --submit", desc = "Submit the completion" },
|
||||
|
||||
{ on = [ "<A-k>" ], exec = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [ "<A-j>" ], exec = "arrow 1", desc = "Move cursor down" },
|
||||
|
||||
{ on = [ "<Up>" ], exec = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [ "<Down>" ], exec = "arrow 1", desc = "Move cursor down" },
|
||||
|
||||
{ on = [ "~" ], exec = "help", desc = "Open help" }
|
||||
]
|
||||
|
|
|
|||
|
|
@ -64,6 +64,16 @@ permissions_s = { fg = "darkgray" }
|
|||
# : }}}
|
||||
|
||||
|
||||
# : Select {{{
|
||||
|
||||
[select]
|
||||
border = { fg = "blue" }
|
||||
active = { fg = "magenta" }
|
||||
inactive = {}
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Input {{{
|
||||
|
||||
[input]
|
||||
|
|
@ -75,16 +85,6 @@ selected = { reversed = true }
|
|||
# : }}}
|
||||
|
||||
|
||||
# : Select {{{
|
||||
|
||||
[select]
|
||||
border = { fg = "blue" }
|
||||
active = { fg = "magenta" }
|
||||
inactive = {}
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Completion {{{
|
||||
|
||||
[completion]
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@ impl Input {
|
|||
}
|
||||
|
||||
pub fn close(&mut self, submit: bool) -> bool {
|
||||
if self.completion {
|
||||
emit!(Call(Exec::call("close", vec![]).vec(), KeymapLayer::Completion));
|
||||
}
|
||||
|
||||
if let Some(cb) = self.callback.take() {
|
||||
let value = self.snap_mut().value.clone();
|
||||
_ = cb.send(if submit { Ok(value) } else { Err(InputError::Canceled(value)) });
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue