| Crates.io | ratatui-eventInput |
| lib.rs | ratatui-eventInput |
| version | 0.2.0 |
| created_at | 2024-12-25 23:37:58.934319+00 |
| updated_at | 2025-02-24 14:47:49.14862+00 |
| description | Unify input from diffrent ratatui backends |
| homepage | |
| repository | https://github.com/Earthgames/ratatui-input |
| max_upload_size | |
| id | 1495283 |
| size | 56,331 |
Unifies input handling from crossterm, termion and termwiz.
It is meant to be used by ratatui libraries to make input handling easier, or allow people using a library to specify what input to listen to.
The default backend is crossterm, if you want to use a different one you need to enable the feature for it:
ratatui-eventInput = {
version = "0.1",
features = [
"crossterm",
"termion",
"termwiz"
] }
After that just use a function like this to handle the input:
use ratatui_eventInput::{Input, Key};
pub fn handle<I: Into<Input>>(&mut self, input: I) {
let input: Input = input.into()
if input.key == Key::Right {
println!("right")
} else if input.key == Key::Left {
println!("left")
}
}
This library does not support all inputs the backends give and is mostly based on the inputs that crossterm uses.