tweaked output

This commit is contained in:
Darren Schroeder 2022-02-01 05:12:41 -06:00
parent 03c197ffbc
commit 606a537bd2
2 changed files with 26 additions and 5 deletions

View File

@ -7,8 +7,8 @@ use {
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Hash, Debug)]
pub struct KeyCombination {
modifier: KeyModifiers,
key_code: KeyCode,
pub modifier: KeyModifiers,
pub key_code: KeyCode,
}
/// Main definition of editor keybindings

View File

@ -133,13 +133,34 @@ pub fn get_reedline_default_keybindings() -> Vec<String> {
let vi_normal = default_vi_insert_keybindings();
let vi_insert = default_vi_insert_keybindings();
for emacs_kb in emacs.get_keybindings() {
keybindings.push(format!("emacs {:?}", emacs_kb));
let mode = "emacs";
let key_modifiers = emacs_kb.0.modifier;
let key_code = emacs_kb.0.key_code;
let event = emacs_kb.1;
keybindings.push(format!(
"mode: {}, key_modifier(s): {:?}, key_code: {:?}, event: {:?}",
mode, key_modifiers, key_code, event
));
}
for vi_n_kb in vi_normal.get_keybindings() {
keybindings.push(format!("vi_normal {:?}", vi_n_kb));
let mode = "vi_normal";
let key_modifiers = vi_n_kb.0.modifier;
let key_code = vi_n_kb.0.key_code;
let event = vi_n_kb.1;
keybindings.push(format!(
"mode: {}, key_modifier(s): {:?}, key_code: {:?}, event: {:?}",
mode, key_modifiers, key_code, event
));
}
for vi_i_kb in vi_insert.get_keybindings() {
keybindings.push(format!("vi insert {:?}", vi_i_kb))
let mode = "vi_insert";
let key_modifiers = vi_i_kb.0.modifier;
let key_code = vi_i_kb.0.key_code;
let event = vi_i_kb.1;
keybindings.push(format!(
"mode: {}, key_modifier(s): {:?}, key_code: {:?}, event: {:?}",
mode, key_modifiers, key_code, event
));
}
keybindings
}