diff --git a/wezterm-gui/src/termwindow/keyevent.rs b/wezterm-gui/src/termwindow/keyevent.rs index ba88d2b57..48e5f4ed3 100644 --- a/wezterm-gui/src/termwindow/keyevent.rs +++ b/wezterm-gui/src/termwindow/keyevent.rs @@ -264,12 +264,6 @@ impl super::TermWindow { } pub fn raw_key_event_impl(&mut self, key: RawKeyEvent, context: &dyn WindowOps) { - if self.config.debug_key_events { - log::info!("key_event {:?}", key); - } else { - log::trace!("key_event {:?}", key); - } - // The leader key is a kind of modal modifier key. // It is allowed to be active for up to the leader timeout duration, // after which it auto-deactivates. @@ -280,6 +274,20 @@ impl super::TermWindow { (false, Modifiers::NONE) }; + if self.config.debug_key_events { + log::info!( + "key_event {:?} {}", + key, + if leader_active { "LEADER" } else { "" } + ); + } else { + log::trace!( + "key_event {:?} {}", + key, + if leader_active { "LEADER" } else { "" } + ); + } + let pane = match self.get_active_pane_or_overlay() { Some(pane) => pane, None => return, @@ -394,12 +402,6 @@ impl super::TermWindow { } pub fn key_event_impl(&mut self, window_key: KeyEvent, context: &dyn WindowOps) { - if self.config.debug_key_events { - log::info!("key_event {:?}", window_key); - } else { - log::trace!("key_event {:?}", window_key); - } - let pane = match self.get_active_pane_or_overlay() { Some(pane) => pane, None => return, @@ -415,6 +417,20 @@ impl super::TermWindow { (false, Modifiers::NONE) }; + if self.config.debug_key_events { + log::info!( + "key_event {:?} {}", + window_key, + if leader_active { "LEADER" } else { "" } + ); + } else { + log::trace!( + "key_event {:?} {}", + window_key, + if leader_active { "LEADER" } else { "" } + ); + } + let modifiers = window_mods_to_termwiz_mods(window_key.modifiers); if self.process_key(