aboutsummaryrefslogtreecommitdiff
path: root/src/input.rs
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-07-04 09:24:51 -0700
committerJoe Wilm <joe@jwilm.com>2016-07-04 09:26:50 -0700
commit6be23659ef5e532eb5825380d436fa86cecd39d7 (patch)
tree8fb58defc0714669153ab2562432ec7169b68b20 /src/input.rs
parentf895c2da30ad6fc71ee66324846b4214b914d200 (diff)
downloadalacritty-6be23659ef5e532eb5825380d436fa86cecd39d7.tar.gz
alacritty-6be23659ef5e532eb5825380d436fa86cecd39d7.zip
Correctly handle Backspace and Delete
The default characters sent for this were incorrect. Delete now sends xterm-compatible escapes (dch1, kdch1), and Backspace sends the delete code 0x7f.
Diffstat (limited to 'src/input.rs')
-rw-r--r--src/input.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/input.rs b/src/input.rs
index ffa19fa8..22e8eeb3 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -230,6 +230,17 @@ static F12_BINDINGS: &'static [Binding] = &[
Binding { mods: modifier::ANY, send: "\x1b[24~", mode: mode::ANY, notmode: mode::NONE },
];
+/// Bindings for the Backspace key
+static BACKSPACE_BINDINGS: &'static [Binding] = &[
+ Binding { mods: modifier::ANY, send: "\x7f", mode: mode::ANY, notmode: mode::NONE },
+];
+
+/// Bindings for the Delete key
+static DELETE_BINDINGS: &'static [Binding] = &[
+ Binding { mods: modifier::ANY, send: "\x1b[3~", mode: mode::APP_KEYPAD, notmode: mode::NONE },
+ Binding { mods: modifier::ANY, send: "\x1b[P", mode: mode::ANY, notmode: mode::APP_KEYPAD },
+];
+
// key mods escape appkey appcursor crlf
//
// notes: appkey = DECPAM (application keypad mode); not enabled is "normal keypad"
@@ -287,6 +298,8 @@ impl Processor {
VirtualKeyCode::F10 => F10_BINDINGS,
VirtualKeyCode::F11 => F11_BINDINGS,
VirtualKeyCode::F12 => F12_BINDINGS,
+ VirtualKeyCode::Back => BACKSPACE_BINDINGS,
+ VirtualKeyCode::Delete => DELETE_BINDINGS,
// Mode keys ignored now
VirtualKeyCode::LAlt | VirtualKeyCode::RAlt | VirtualKeyCode::LShift |
VirtualKeyCode::RShift | VirtualKeyCode::LControl | VirtualKeyCode::RControl |