From 56db9cfce1d5f830aa814a4a180813912efb4d66 Mon Sep 17 00:00:00 2001 From: unspeaker Date: Sun, 15 Sep 2024 17:36:20 +0300 Subject: [PATCH] fix: add missing flush --- crates/tek_core/examples/demo.rs | 2 +- crates/tek_core/src/tui.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/tek_core/examples/demo.rs b/crates/tek_core/examples/demo.rs index 7123e6c3..7058b2c0 100644 --- a/crates/tek_core/examples/demo.rs +++ b/crates/tek_core/examples/demo.rs @@ -106,7 +106,7 @@ impl Content for Demo { } impl Handle for Demo { - fn handle (&mut self, from: &Tui) -> Perhaps { + fn handle (&mut self, from: &TuiInput) -> Perhaps { match from.event() { key!(KeyCode::PageUp) => { self.index = (self.index + 1) % self.items.len(); diff --git a/crates/tek_core/src/tui.rs b/crates/tek_core/src/tui.rs index a6b0eb59..300fbd9d 100644 --- a/crates/tek_core/src/tui.rs +++ b/crates/tek_core/src/tui.rs @@ -61,7 +61,7 @@ impl Tui { let engine = Arc::new(RwLock::new(engine)); let _input_thread = Self::spawn_input_thread(&engine, &state, Duration::from_millis(100)); engine.write().unwrap().setup()?; - let render_thread = Self::spawn_render_thread(&engine, &state, Duration::from_millis(20)); + let render_thread = Self::spawn_render_thread(&engine, &state, Duration::from_millis(10)); render_thread.join().expect("main thread failed"); engine.write().unwrap().teardown()?; Ok(state) @@ -122,6 +122,7 @@ impl Tui { fn flip (&mut self, mut buffer: Buffer) -> Buffer { let updates = self.buffer.diff(&buffer); self.backend.draw(updates.into_iter()).expect("failed to render"); + self.backend.flush(); std::mem::swap(&mut self.buffer, &mut buffer); buffer.reset(); buffer