1
1
mirror of https://github.com/wez/wezterm.git synced 2024-10-26 15:52:29 +03:00
wezterm/termwiz/examples/key_tester.rs
Wez Furlong 42f855d912 termwiz: request xterm modifyOtherKeys
When in raw mode, go to level 2, but use level 1 for cooked
so that we don't obfuscate ctrl-c.

A consequnce of this is that CTRL-C is now reported to the app
as CTRL-lowercase-c where we previously reported as CTRL-uppercase-C.
Made a note of the breaking nature of this change in a new changelog
file.

Fixed recognizing SHIFT-TAB

refs: https://github.com/wez/wezterm/issues/2511
2022-09-21 21:07:10 -07:00

25 lines
609 B
Rust

use termwiz::caps::Capabilities;
use termwiz::input::{InputEvent, KeyCode, KeyEvent, Modifiers};
use termwiz::terminal::{new_terminal, Terminal};
use termwiz::Error;
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(())
}