1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 05:42:03 +03:00

term: propagate wezterm debug_key_events config

Log the sequence being sent to the terminal when enabled.
This commit is contained in:
Wez Furlong 2022-01-06 08:00:29 -07:00
parent 51aec27ec2
commit dc204c03d6
3 changed files with 13 additions and 1 deletions

View File

@ -78,4 +78,8 @@ impl wezterm_term::TerminalConfiguration for TermConfig {
fn unicode_version(&self) -> u8 {
self.configuration().unicode_version
}
fn debug_key_events(&self) -> bool {
self.configuration().debug_key_events
}
}

View File

@ -95,4 +95,8 @@ pub trait TerminalConfiguration: std::fmt::Debug {
fn unicode_version(&self) -> u8 {
9
}
fn debug_key_events(&self) -> bool {
false
}
}

View File

@ -26,7 +26,11 @@ impl TerminalState {
},
)?;
log::trace!("sending {:?}, {:?}", to_send, key);
if self.config.debug_key_events() {
log::info!("key_down: sending {:?}, {:?} {:?}", to_send, key, mods);
} else {
log::trace!("key_down: sending {:?}, {:?} {:?}", to_send, key, mods);
}
self.writer.write_all(to_send.as_bytes())?;
self.writer.flush()?;