feat: support submit completion and input at once by using <Enter> key (#565)

This commit is contained in:
三咲雅 · Misaki Masa 2024-01-23 16:45:57 +08:00 committed by GitHub
parent 0c0a0f319d
commit 3248dbd8bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -258,8 +258,9 @@ keymap = [
[completion]
keymap = [
{ on = [ "<C-q>" ], exec = "close", desc = "Cancel completion" },
{ on = [ "<Tab>" ], exec = "close --submit", desc = "Submit the completion" },
{ on = [ "<C-q>" ], exec = "close", desc = "Cancel completion" },
{ on = [ "<Tab>" ], exec = "close --submit", desc = "Submit the completion" },
{ on = [ "<Enter>" ], exec = [ "close --submit", "close_input --submit" ], desc = "Submit the completion and input" },
{ on = [ "<A-k>" ], exec = "arrow -1", desc = "Move cursor up" },
{ on = [ "<A-j>" ], exec = "arrow 1", desc = "Move cursor down" },

View file

@ -270,6 +270,7 @@ impl<'a> Executor<'a> {
#[allow(clippy::single_match)]
match exec.cmd.as_str() {
"help" => self.app.cx.help.toggle(Layer::Completion),
"close_input" => self.app.cx.input.close(exec),
_ => {}
}
}