crossterm-rs / crossterm

Cross platform terminal library rust
MIT License
3.29k stars 280 forks source link

Fix `poll(Duration::ZERO)` with `use-dev-tty` #840

Open Hirevo opened 1 year ago

Hirevo commented 1 year ago

This PR fixes the incorrect behaviour of crossterm::event::poll(Duration::ZERO) when use-dev-tty is used.

Previously, events that were already buffered were only checked if some amount of time was left before the timeout, which is never the case when Duration::ZERO is used, which did lead to events being buffered but unreported.

Now, we always check buffered events at least once, regardless of timeout.

Fixes #839.