aboutsummaryrefslogtreecommitdiff
path: root/src/term
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-12-29 21:38:22 -0500
committerJoe Wilm <joe@jwilm.com>2016-12-29 21:38:22 -0500
commita91a3f2dce121a179a9371cd0ad1e548cf3d7731 (patch)
tree311f1ee1b60eb9fb11bad3bdee8812d3be5590b8 /src/term
parentb704dafb2420df6f7fca64980a2f52c1a00bcef5 (diff)
downloadr-alacritty-a91a3f2dce121a179a9371cd0ad1e548cf3d7731.tar.gz
r-alacritty-a91a3f2dce121a179a9371cd0ad1e548cf3d7731.tar.bz2
r-alacritty-a91a3f2dce121a179a9371cd0ad1e548cf3d7731.zip
Fix pty read sometimes not triggering draw
There was a lot of complexity around the threadsafe `Flag` type and waking up the event loop. The idea was to prevent unnecessary calls to the glutin window's wakeup_event_loop() method which can be expensive. This complexity made it difficult to get synchronization between the pty reader and the render thread correct. Now, the `dirty` flag on the terminal is also used to prevent spurious wakeups. It is only changed when the mutex is held, so race conditions associated with that flag shouldn't happen.
Diffstat (limited to 'src/term')
-rw-r--r--src/term/mod.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs
index 29bf6b83..4e4a022c 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -298,7 +298,7 @@ impl Term {
let scroll_region = Line(0)..grid.num_lines();
Term {
- dirty: true,
+ dirty: false,
grid: grid,
alt_grid: alt,
alt: false,
@@ -313,6 +313,11 @@ impl Term {
}
}
+ #[inline]
+ pub fn needs_draw(&self) -> bool {
+ self.dirty
+ }
+
pub fn string_from_selection(&self, span: &Span) -> String {
/// Need a generic push() for the Append trait
trait PushChar {