aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanuj <tanuj@tutanota.com>2019-02-16 20:23:23 +0000
committerChristian Duerr <chrisduerr@users.noreply.github.com>2019-02-16 20:23:23 +0000
commit1e815dca570e25c4346f249945d0f2e60d52dc16 (patch)
tree45ee14855c77f9c7a910aecd4a24897f0cbb9bd9
parent9392b8e837b78a336f20ad883edae1b440dca908 (diff)
downloadalacritty-1e815dca570e25c4346f249945d0f2e60d52dc16.tar.gz
alacritty-1e815dca570e25c4346f249945d0f2e60d52dc16.zip
Add early return to `received_char`
-rw-r--r--src/input.rs40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/input.rs b/src/input.rs
index 95817cf6..11091575 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -751,29 +751,31 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
/// Process a received character
pub fn received_char(&mut self, c: char) {
- if !*self.ctx.suppress_chars() {
- self.ctx.scroll(Scroll::Bottom);
- self.ctx.clear_selection();
-
- let utf8_len = c.len_utf8();
- let mut bytes = Vec::with_capacity(utf8_len);
- unsafe {
- bytes.set_len(utf8_len);
- c.encode_utf8(&mut bytes[..]);
- }
+ if *self.ctx.suppress_chars() {
+ return;
+ }
- if self.alt_send_esc
- && *self.ctx.received_count() == 0
- && self.ctx.last_modifiers().alt
- && utf8_len == 1
- {
- bytes.insert(0, b'\x1b');
- }
+ self.ctx.scroll(Scroll::Bottom);
+ self.ctx.clear_selection();
- self.ctx.write_to_pty(bytes);
+ let utf8_len = c.len_utf8();
+ let mut bytes = Vec::with_capacity(utf8_len);
+ unsafe {
+ bytes.set_len(utf8_len);
+ c.encode_utf8(&mut bytes[..]);
+ }
- *self.ctx.received_count() += 1;
+ if self.alt_send_esc
+ && *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;
}
/// Attempts to find a binding and execute its action