mirror of
https://github.com/wez/wezterm.git
synced 2024-11-22 04:56:12 +03:00
42f855d912
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
25 lines
609 B
Rust
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(())
|
|
}
|