aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskliew <skliew@gmail.com>2018-12-20 08:33:42 +0800
committerChristian Duerr <chrisduerr@users.noreply.github.com>2018-12-20 00:33:42 +0000
commitc47c52d8444bb30e72fc11a99e7ab34561f09740 (patch)
tree5062bd46f084ed3aa1bb0cb245cabe473681a9ac
parente1ee890750f2b18acd8e37cca105cfcb150fd2ca (diff)
downloadalacritty-c47c52d8444bb30e72fc11a99e7ab34561f09740.tar.gz
alacritty-c47c52d8444bb30e72fc11a99e7ab34561f09740.zip
Send alt key with actual key in one flush
The delay between the alt key and the actual received key might cause certain key sequences to be missed, ex. when tmux has its escape-time set to 0.
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/input.rs8
2 files changed, 5 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8ef9fcc4..7ae5f202 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix color issue in ncurses programs by updating terminfo pairs from 0x10000 to 0x7FFF
- Fix panic after quitting Alacritty on macOS
- Tabs are no longer replaced by spaces when copying them to the clipboard
+- Alt modifier is no longer sent separately from the modified key
## Version 0.2.4
diff --git a/src/input.rs b/src/input.rs
index 07887ad9..23ccdd58 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -687,16 +687,16 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
self.ctx.clear_selection();
let utf8_len = c.len_utf8();
- if *self.ctx.received_count() == 0 && self.ctx.last_modifiers().alt && utf8_len == 1 {
- self.ctx.write_to_pty(b"\x1b".to_vec());
- }
-
let mut bytes = Vec::with_capacity(utf8_len);
unsafe {
bytes.set_len(utf8_len);
c.encode_utf8(&mut bytes[..]);
}
+ if *self.ctx.received_count() == 0 && self.ctx.last_modifiers().alt && utf8_len == 1 {
+ bytes.insert(0, b'\x1b');
+ }
+
self.ctx.write_to_pty(bytes);
*self.ctx.received_count() += 1;