diff options
author | Martin Algesten <martin@algesten.se> | 2017-05-21 18:25:08 +0200 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-05-24 09:10:11 -0700 |
commit | 262c70be573d4511b89305e8bea2306b028bc924 (patch) | |
tree | af34b500effcd0df3a6518ed9c12322f2c31e53b | |
parent | 32248471667dbdea33fca5e12fa0cb8a43482106 (diff) | |
download | alacritty-262c70be573d4511b89305e8bea2306b028bc924.tar.gz alacritty-262c70be573d4511b89305e8bea2306b028bc924.zip |
Fix #573. Ensure we don't write 0 bytes to pty
Any action that results in 0 bytes, such as pasting 0 bytes
from the clipboard hangs the terminal (`pbcopy </dev/null`
followed by ctrl-v), hangs the terminal on both macOS and
Linux. This ensures we never send 0 bytes.
-rw-r--r-- | src/event_loop.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/event_loop.rs b/src/event_loop.rs index 2cee471c..8db5cddd 100644 --- a/src/event_loop.rs +++ b/src/event_loop.rs @@ -60,6 +60,10 @@ impl event::Notify for Notifier { where B: Into<Cow<'static, [u8]>> { let bytes = bytes.into(); + // terminal hangs if we send 0 bytes through. + if bytes.len() == 0 { + return + } match self.0.send(Msg::Input(bytes)) { Ok(_) => (), Err(_) => panic!("expected send event loop msg"), |