Avoid accidental application mode delete output in key processing

I thought that I'd broken something with the DEL processing in vim with
the new frontend but it turned out that the other frontend was emitting
BS always and that I'd actuall unbroken passing DEL through and that
other layers were translating DEL into an application cursor mode output
for DEL that emits a totally different sequence.

This diff preserves DEL and disables that other sequence.

Will follow up with some explicit configuration to control this
behavior, but in the short term, the default behavior should be much
closer to what people actually want and expect!

refs: https://github.com/wez/wezterm/issues/52
This commit is contained in:
Wez Furlong committed 2019-10-27 23:59:15 -07:00
1 parent d5b02edad2
commit d80169ceff
3 files changed
+5 -5

No files matched your search

+2 -1
View File
@@ -850,7 +850,8 @@ impl TerminalState {
(Escape, ..) => "\x1b",
// Delete
(Char('\x7f'), _, _, _, false) | (Delete, _, _, _, false) => "\x7f",
(Char('\x7f'), ..) | (Delete, ..) => "\x1b[3~",
// TODO: application delete key? See https://github.com/wez/wezterm/issues/52
(Char('\x7f'), _, _, _, true) | (Delete, _, _, _, true) => "\x7f", // "\x1b[3~"
(Char(c), CTRL, _, SHIFT, _) if c <= 0xff as char && c > 0x40 as char => {
// If shift is held we have C == 0x43 and want to translate
+3 -2
View File
@@ -560,7 +560,8 @@ impl InputParser {
for (keycode, c) in &[
(KeyCode::Insert, b'2'),
(KeyCode::Delete, b'3'),
// TODO: application delete key? See https://github.com/wez/wezterm/issues/52
// (KeyCode::Delete, b'3'),
(KeyCode::Home, b'1'),
(KeyCode::End, b'4'),
(KeyCode::PageUp, b'5'),
@@ -579,7 +580,7 @@ impl InputParser {
map.insert(
&[0x7f],
InputEvent::Key(KeyEvent {
key: KeyCode::Backspace,
key: KeyCode::Delete,
modifiers: Modifiers::NONE,
}),
);
-2
View File
@@ -643,8 +643,6 @@ impl WindowView {
'\u{f72b}' => KeyCode::End,
'\u{f72c}' => KeyCode::PageUp,
'\u{f72d}' => KeyCode::PageDown,
// rewrite Del to Backspace
'\u{7f}' => KeyCode::Char('\u{8}'),
_ => KeyCode::Char(first_char),
}
} else {