fix: change crossterm poll timeout to 10ms from 1s (#983)

Problem: Key events were delayed signifantly in TUI widgets.
Solution: Decrease crossterm event poll timeout from 1000ms to 10ms.

Fixes #978
This commit is contained in:
Will Hopkins authored and GitHub committed 2023-04-24 16:13:54 -05:00
1 parent 6ea61d4c52
commit 8af3522a2e
1 file changed
+2 -1
+2 -1
View File
@@ -98,7 +98,8 @@ pub fn render<R: Driver>(
let event_tx_clone = event_tx.clone();
if !cfg.headless {
std::thread::spawn(move || {
let tick_rate = Duration::from_millis(1000);
// Timeout after 10ms when waiting for events
let tick_rate = Duration::from_millis(10);
loop {
if crossterm::event::poll(tick_rate).unwrap() {
let evt = crossterm::event::read().unwrap();