diff --git a/src/tui/mod.rs b/src/tui/mod.rs index 1461f67..8a70af7 100644 --- a/src/tui/mod.rs +++ b/src/tui/mod.rs @@ -13,6 +13,7 @@ use std::{ path::{Path, PathBuf}, process::exit, sync::Arc, + time::Duration, }; use tui_widget_list::{ListBuilder, ListView}; @@ -408,6 +409,11 @@ impl App { terminal.draw(|frame| frame.render_widget(&mut self, frame.area()))?; + // update every 250ms or more if there's an event + if !event::poll(Duration::from_millis(250))? { + continue; + } + match event::read()? { Event::Key(key) => { // to initialize, but we then do get manually for borrow reasons @@ -507,9 +513,9 @@ impl App { let block = Block::bordered() .style(styles.default) .border_style(if selected { - styles.border - } else { styles.border_highlighted + } else { + styles.border }); let inner = block.inner(area); block.render(area, buf);