diff --git a/config/src/terminal.rs b/config/src/terminal.rs index ead942202..760bc3fe1 100644 --- a/config/src/terminal.rs +++ b/config/src/terminal.rs @@ -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 + } } diff --git a/term/src/config.rs b/term/src/config.rs index d5f8bb201..f781c379c 100644 --- a/term/src/config.rs +++ b/term/src/config.rs @@ -95,4 +95,8 @@ pub trait TerminalConfiguration: std::fmt::Debug { fn unicode_version(&self) -> u8 { 9 } + + fn debug_key_events(&self) -> bool { + false + } } diff --git a/term/src/terminalstate/keyboard.rs b/term/src/terminalstate/keyboard.rs index 809d45791..86d679bdb 100644 --- a/term/src/terminalstate/keyboard.rs +++ b/term/src/terminalstate/keyboard.rs @@ -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()?;