aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-07-16 12:25:57 -0700
committerJoe Wilm <joe@jwilm.com>2016-07-16 12:25:57 -0700
commit4bc411998786b0893a18df4d88012470d42abf91 (patch)
tree0213c6eec42494aaf43f97ad3c6d495c5fe10217 /src
parent9a7bfba93c68b8d3311879a35d77f37302217462 (diff)
downloadalacritty-4bc411998786b0893a18df4d88012470d42abf91.tar.gz
alacritty-4bc411998786b0893a18df4d88012470d42abf91.zip
Fix Control-H bug
Glutin sends both a received character and the key pressed event when a key is pressed. Because delete and backspace are mapped in reverse by terminal standards, we ignore the received character 0x07 and 0x7f values. However, this breaks Control-H since this normally sends 0x07 as well. The fix here adds handling for Control-H through the input tracking system.
Diffstat (limited to 'src')
-rw-r--r--src/input.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/input.rs b/src/input.rs
index 22e8eeb3..f452aa4e 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -230,6 +230,15 @@ static F12_BINDINGS: &'static [Binding] = &[
Binding { mods: modifier::ANY, send: "\x1b[24~", mode: mode::ANY, notmode: mode::NONE },
];
+/// Bindings for the H key
+///
+/// Control-H sends 0x08 normally, but we capture that in ReceivedCharacter
+/// since DEL and BACKSPACE are inverted. This binding is a work around to that
+/// capture.
+static H_BINDINGS: &'static [Binding] = &[
+ Binding { mods: modifier::CONTROL, send: "\x08", 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 },
@@ -300,6 +309,7 @@ impl Processor {
VirtualKeyCode::F12 => F12_BINDINGS,
VirtualKeyCode::Back => BACKSPACE_BINDINGS,
VirtualKeyCode::Delete => DELETE_BINDINGS,
+ VirtualKeyCode::H => H_BINDINGS,
// Mode keys ignored now
VirtualKeyCode::LAlt | VirtualKeyCode::RAlt | VirtualKeyCode::LShift |
VirtualKeyCode::RShift | VirtualKeyCode::LControl | VirtualKeyCode::RControl |
@@ -307,7 +317,7 @@ impl Processor {
// All of the alphanumeric keys get passed through here as well, but there's no work
// to be done for them.
VirtualKeyCode::A | VirtualKeyCode::B | VirtualKeyCode::C | VirtualKeyCode::D |
- VirtualKeyCode::E | VirtualKeyCode::F | VirtualKeyCode::G | VirtualKeyCode::H |
+ VirtualKeyCode::E | VirtualKeyCode::F | VirtualKeyCode::G |
VirtualKeyCode::I | VirtualKeyCode::J | VirtualKeyCode::K | VirtualKeyCode::L |
VirtualKeyCode::M | VirtualKeyCode::N | VirtualKeyCode::O | VirtualKeyCode::P |
VirtualKeyCode::Q | VirtualKeyCode::R | VirtualKeyCode::S | VirtualKeyCode::T |