From c47c52d8444bb30e72fc11a99e7ab34561f09740 Mon Sep 17 00:00:00 2001 From: skliew Date: Thu, 20 Dec 2018 08:33:42 +0800 Subject: 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. --- src/input.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') 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; -- cgit