mirror of
https://github.com/wez/wezterm.git
synced 2024-11-24 07:46:59 +03:00
25 lines
608 B
Rust
25 lines
608 B
Rust
use anyhow::Error;
|
|
use termwiz::caps::Capabilities;
|
|
use termwiz::input::{InputEvent, KeyCode, KeyEvent, Modifiers};
|
|
use termwiz::terminal::{new_terminal, Terminal};
|
|
|
|
const CTRL_C: KeyEvent = KeyEvent {
|
|
key: KeyCode::Char('C'),
|
|
modifiers: Modifiers::CTRL,
|
|
};
|
|
|
|
fn main() -> Result<(), Error> {
|
|
let caps = Capabilities::new_from_env()?;
|
|
let mut terminal = new_terminal(caps)?;
|
|
terminal.set_raw_mode()?;
|
|
|
|
while let Some(event) = terminal.poll_input(None)? {
|
|
print!("{:?}\r\n", event);
|
|
if event == InputEvent::Key(CTRL_C) {
|
|
break;
|
|
}
|
|
}
|
|
|
|
Ok(())
|
|
}
|