mirror of
https://github.com/nushell/nushell.git
synced 2025-01-25 23:58:41 +01:00
a few things that make it easier to debug keybindings (#3752)
This commit is contained in:
parent
69fa040361
commit
70215fe480
@ -410,7 +410,7 @@ pub enum CharSearch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The set of modifier keys that were triggered along with a key press.
|
/// 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)]
|
#[allow(non_camel_case_types)]
|
||||||
pub enum NuModifiers {
|
pub enum NuModifiers {
|
||||||
/// Control modifier
|
/// Control modifier
|
||||||
@ -442,7 +442,7 @@ pub enum NuModifiers {
|
|||||||
/// The number of times one command should be repeated.
|
/// The number of times one command should be repeated.
|
||||||
pub type RepeatCount = usize;
|
pub type RepeatCount = usize;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct Keybinding {
|
pub struct Keybinding {
|
||||||
key: KeyCode,
|
key: KeyCode,
|
||||||
modifiers: Option<NuModifiers>,
|
modifiers: Option<NuModifiers>,
|
||||||
@ -460,9 +460,10 @@ pub(crate) fn load_keybindings(
|
|||||||
// Silently fail if there is no file there
|
// Silently fail if there is no file there
|
||||||
if let Ok(contents) = contents {
|
if let Ok(contents) = contents {
|
||||||
let keybindings: Keybindings = serde_yaml::from_str(&contents)?;
|
let keybindings: Keybindings = serde_yaml::from_str(&contents)?;
|
||||||
// eprint!("{}{}{}", keybindings.key, keybindings.mo);
|
// eprintln!("{:#?}", keybindings);
|
||||||
for keybinding in keybindings.into_iter() {
|
for keybinding in keybindings.into_iter() {
|
||||||
let (k, b) = convert_keybinding(keybinding);
|
let (k, b) = convert_keybinding(keybinding);
|
||||||
|
// eprintln!("{:?} {:?}", k, b);
|
||||||
|
|
||||||
rl.bind_sequence(k, b);
|
rl.bind_sequence(k, b);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user