aboutsummaryrefslogtreecommitdiff
path: root/src/main.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/main.rs
parentf895c2da30ad6fc71ee66324846b4214b914d200 (diff)
downloadr-alacritty-6be23659ef5e532eb5825380d436fa86cecd39d7.tar.gz
r-alacritty-6be23659ef5e532eb5825380d436fa86cecd39d7.tar.bz2
r-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/main.rs')
-rw-r--r--src/main.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 5cf1be15..0cd1e674 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -230,8 +230,14 @@ fn main() {
match event {
glutin::Event::Closed => break 'main_loop,
glutin::Event::ReceivedCharacter(c) => {
- let encoded = c.encode_utf8();
- writer.write(encoded.as_slice()).unwrap();
+ match c {
+ // Ignore BACKSPACE and DEL. These are handled specially.
+ '\u{8}' | '\u{7f}' => (),
+ _ => {
+ let encoded = c.encode_utf8();
+ writer.write(encoded.as_slice()).unwrap();
+ }
+ }
},
glutin::Event::Resized(w, h) => {
terminal.resize(w as f32, h as f32);