feat(shell): allow mapping ctrl-space for builtin shell autocomplete integration (#370)

fixes #366
This commit is contained in:
Alexandre Pasmantier 2025-03-05 17:40:25 +01:00 committed by alexpasmantier
parent 3441587d57
commit 46f5d20b2c
2 changed files with 3 additions and 1 deletions

View File

@ -196,7 +196,7 @@ fn parse_key_code_with_modifiers(
"f10" => KeyCode::F(10), "f10" => KeyCode::F(10),
"f11" => KeyCode::F(11), "f11" => KeyCode::F(11),
"f12" => KeyCode::F(12), "f12" => KeyCode::F(12),
"space" => KeyCode::Char(' '), "space" | " " => KeyCode::Char(' '),
"hyphen" | "minus" => KeyCode::Char('-'), "hyphen" | "minus" => KeyCode::Char('-'),
"tab" => KeyCode::Tab, "tab" => KeyCode::Tab,
c if c.len() == 1 => { c if c.len() == 1 => {

View File

@ -52,6 +52,7 @@ impl ShellIntegrationConfig {
match self.keybindings.get(SMART_AUTOCOMPLETE_CONFIGURATION_KEY) { match self.keybindings.get(SMART_AUTOCOMPLETE_CONFIGURATION_KEY) {
Some(s) => match parse_key(s) { Some(s) => match parse_key(s) {
Ok(Key::Ctrl(c)) => c.to_uppercase().next().unwrap(), Ok(Key::Ctrl(c)) => c.to_uppercase().next().unwrap(),
Ok(Key::CtrlSpace) => ' ',
_ => DEFAULT_SHELL_AUTOCOMPLETE_KEY, _ => DEFAULT_SHELL_AUTOCOMPLETE_KEY,
}, },
None => DEFAULT_SHELL_AUTOCOMPLETE_KEY, None => DEFAULT_SHELL_AUTOCOMPLETE_KEY,
@ -64,6 +65,7 @@ impl ShellIntegrationConfig {
match self.keybindings.get(COMMAND_HISTORY_CONFIGURATION_KEY) { match self.keybindings.get(COMMAND_HISTORY_CONFIGURATION_KEY) {
Some(s) => match parse_key(s) { Some(s) => match parse_key(s) {
Ok(Key::Ctrl(c)) => c.to_uppercase().next().unwrap(), Ok(Key::Ctrl(c)) => c.to_uppercase().next().unwrap(),
Ok(Key::CtrlSpace) => ' ',
_ => DEFAULT_COMMAND_HISTORY_KEY, _ => DEFAULT_COMMAND_HISTORY_KEY,
}, },
None => DEFAULT_COMMAND_HISTORY_KEY, None => DEFAULT_COMMAND_HISTORY_KEY,