Remove double key prevention

After rewrite to use Named keys, the double key prevention code
instead made Ctrl-Bakspace et al. to not work again. Now the
prevention code is not needed any more, so this patch removes it.
This commit is contained in:
Mattias Eriksson 2024-02-19 07:38:24 +01:00 • committed by Jeremy Soller
parent 7013a3e1ce
commit f6d696f7d6

View file

@ -677,21 +677,20 @@ where
//Special handle Enter, Escape, Backspace and Tab as described in //Special handle Enter, Escape, Backspace and Tab as described in
//https://sw.kovidgoyal.net/kitty/keyboard-protocol/#legacy-key-event-encoding //https://sw.kovidgoyal.net/kitty/keyboard-protocol/#legacy-key-event-encoding
//Also special handle Ctrl-_ to behave like xterm //Also special handle Ctrl-_ to behave like xterm
//Let CharacterRecieved event handle Ctrl keys if possible
let alt_prefix = if modifiers.alt() { "\x1B" } else { "" }; let alt_prefix = if modifiers.alt() { "\x1B" } else { "" };
match named { match named {
Named::Backspace if !modifiers.control() => { Named::Backspace => {
let code = "\x7f"; let code = if modifiers.control() { "\x08" } else { "\x7f" };
terminal terminal
.input_scroll(format!("{}{}", alt_prefix, code).as_bytes().to_vec()); .input_scroll(format!("{}{}", alt_prefix, code).as_bytes().to_vec());
status = Status::Captured; status = Status::Captured;
} }
Named::Enter if !modifiers.control() => { Named::Enter => {
terminal terminal
.input_scroll(format!("{}{}", alt_prefix, "\x0D").as_bytes().to_vec()); .input_scroll(format!("{}{}", alt_prefix, "\x0D").as_bytes().to_vec());
status = Status::Captured; status = Status::Captured;
} }
Named::Escape if !modifiers.control() => { Named::Escape => {
//Escape with any modifier will cancel selection //Escape with any modifier will cancel selection
let had_selection = { let had_selection = {
let mut term = terminal.term.lock(); let mut term = terminal.term.lock();
@ -706,7 +705,7 @@ where
} }
status = Status::Captured; status = Status::Captured;
} }
Named::Space if !modifiers.control() => { Named::Space => {
terminal.input_scroll(format!("{}{}", alt_prefix, " ").as_bytes().to_vec()); terminal.input_scroll(format!("{}{}", alt_prefix, " ").as_bytes().to_vec());
status = Status::Captured; status = Status::Captured;
} }
@ -733,11 +732,7 @@ where
return Status::Captured; return Status::Captured;
} }
} }
//Tab and Delete is handled by the KeyPress event
let character = text.and_then(|c| c.chars().next()).unwrap_or_default(); let character = text.and_then(|c| c.chars().next()).unwrap_or_default();
if character as u32 == 9 || character as u32 == 127 {
return status;
}
match ( match (
modifiers.logo(), modifiers.logo(),
modifiers.control(), modifiers.control(),