mirror of
https://github.com/ratatui/ratatui.git
synced 2025-09-28 13:31:14 +00:00

Crossterm 0.29 introduced methods to easily check / extract the event type. E.g. as_key_press_event() and is_key_press(). This commit updates the examples to use these methods instead of matching on the event type. This makes the code cleaner and easier to read. Also does a general cleanup of the event handling code in the examples.
Demo example
This is the original demo that was developed for Tui-rs (the library that Ratatui was forked from).
This example is available for each backend. To run it:
crossterm
cargo run -p demo
termion
cargo run -p demo --no-default-features --features termion
termwiz
cargo run -p demo --no-default-features --features termwiz