diff options
Diffstat (limited to 'src/event_loop.rs')
-rw-r--r-- | src/event_loop.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/event_loop.rs b/src/event_loop.rs index ce034ff0..c81d83c9 100644 --- a/src/event_loop.rs +++ b/src/event_loop.rs @@ -255,6 +255,9 @@ impl<Io> EventLoop<Io> let mut processed = 0; let mut terminal = None; + // Flag to keep track if wakeup has already been sent + let mut send_wakeup = false; + loop { match self.pty.read(&mut buf[..]) { Ok(0) => break, @@ -272,10 +275,14 @@ impl<Io> EventLoop<Io> // Get reference to terminal. Lock is acquired on initial // iteration and held until there's no bytes left to parse // or we've reached MAX_READ. - if terminal.is_none() { + let terminal = if terminal.is_none() { terminal = Some(self.terminal.lock()); - } - let terminal = terminal.as_mut().unwrap(); + let terminal = terminal.as_mut().unwrap(); + send_wakeup = !terminal.dirty; + terminal + } else { + terminal.as_mut().unwrap() + }; // Run the parser for byte in &buf[..got] { @@ -301,7 +308,7 @@ impl<Io> EventLoop<Io> // Only request a draw if one hasn't already been requested. if let Some(mut terminal) = terminal { - if !terminal.dirty { + if send_wakeup { self.display.notify(); terminal.dirty = true; } |