Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions examples/yarnspinner_without_bevy/src/terminal.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! This module is here for using ratatui to interact with the terminal and
//! crossterm to listen to input. It does not contain any code specific to yarnspinner

use std::io::Stdout;
use std::{io::Stdout, time::Duration};

use crossterm::event::{Event, KeyCode, KeyEventKind};
use ratatui::backend::CrosstermBackend;
Expand Down Expand Up @@ -35,7 +35,8 @@ pub fn set_panic_hook() {
}

pub fn poll_input() -> anyhow::Result<Option<KeyCode>> {
if let Event::Key(key) = crossterm::event::read()?
if crossterm::event::poll(Duration::from_millis(100))?
&& let Event::Key(key) = crossterm::event::read()?
&& key.kind == KeyEventKind::Press
{
return Ok(Some(key.code));
Expand Down
Loading