From 70215fe4807ac7a7fb4804900c8882c7ddcb4de1 Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Thu, 8 Jul 2021 08:56:54 -0500 Subject: [PATCH] a few things that make it easier to debug keybindings (#3752) --- crates/nu-cli/src/keybinding.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/nu-cli/src/keybinding.rs b/crates/nu-cli/src/keybinding.rs index 2b2b45b875..a5cea6c7f4 100644 --- a/crates/nu-cli/src/keybinding.rs +++ b/crates/nu-cli/src/keybinding.rs @@ -410,7 +410,7 @@ pub enum CharSearch { } /// The set of modifier keys that were triggered along with a key press. -#[derive(Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize)] #[allow(non_camel_case_types)] pub enum NuModifiers { /// Control modifier @@ -442,7 +442,7 @@ pub enum NuModifiers { /// The number of times one command should be repeated. pub type RepeatCount = usize; -#[derive(Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize)] pub struct Keybinding { key: KeyCode, modifiers: Option, @@ -460,9 +460,10 @@ pub(crate) fn load_keybindings( // Silently fail if there is no file there if let Ok(contents) = contents { let keybindings: Keybindings = serde_yaml::from_str(&contents)?; - // eprint!("{}{}{}", keybindings.key, keybindings.mo); + // eprintln!("{:#?}", keybindings); for keybinding in keybindings.into_iter() { let (k, b) = convert_keybinding(keybinding); + // eprintln!("{:?} {:?}", k, b); rl.bind_sequence(k, b); }