diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-03 08:17:08 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-03 08:17:08 -0600 |
| commit | 02c5605d29d659605c9066a9d5aa2b14fb5c2c7f (patch) | |
| tree | 28c244313e182f91235f28649ab03f0307e1f24c | |
| parent | 7bcae0a698bb5362e5df3a89c889786ce9eac944 (diff) | |
fix: enable real-time progress updates during playback
Replace blocking event.read() with event.poll() to allow UI refreshes
every 100ms without waiting for keyboard input. This fixes the frozen
progress display issue and enables smooth real-time position updates
while audio is playing.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
| -rw-r--r-- | src/main.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 318d79d..74be777 100644 --- a/src/main.rs +++ b/src/main.rs @@ -102,8 +102,10 @@ fn run_app<B: Backend>(terminal: &mut Terminal<B>, app: &mut App) -> Result<()> terminal.draw(|f| ui(f, app))?; - if let Event::Key(key) = event::read()? { - match app.current_screen { + // Use poll instead of read to avoid blocking, allowing for regular UI updates + if event::poll(std::time::Duration::from_millis(100))? { + if let Event::Key(key) = event::read()? { + match app.current_screen { CurrentScreen::FeedList => match key.code { KeyCode::Char('q') => return Ok(()), KeyCode::Char('j') | KeyCode::Down => app.next_feed(), @@ -136,6 +138,7 @@ fn run_app<B: Backend>(terminal: &mut Terminal<B>, app: &mut App) -> Result<()> _ => {} }, } + } } } } |
