diff options
Diffstat (limited to 'helix-term/src/keymap.rs')
-rw-r--r-- | helix-term/src/keymap.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs index 416dcd86..e94a5f66 100644 --- a/helix-term/src/keymap.rs +++ b/helix-term/src/keymap.rs @@ -600,4 +600,43 @@ mod tests { "Mismatch" ) } + + #[test] + fn escaped_keymap() { + use crate::commands::MappableCommand; + use helix_view::input::{KeyCode, KeyEvent, KeyModifiers}; + + let keys = r#" +"+" = [ + "select_all", + ":pipe sed -E 's/\\s+$//g'", +] + "#; + + let key = KeyEvent { + code: KeyCode::Char('+'), + modifiers: KeyModifiers::NONE, + }; + + let expectation = Keymap::new(KeyTrie::Node(KeyTrieNode::new( + "", + hashmap! { + key => KeyTrie::Sequence(vec!{ + MappableCommand::select_all, + MappableCommand::Typable { + name: "pipe".to_string(), + args: vec!{ + "sed".to_string(), + "-E".to_string(), + "'s/\\s+$//g'".to_string() + }, + doc: "".to_string(), + }, + }) + }, + vec![key], + ))); + + assert_eq!(toml::from_str(keys), Ok(expectation)); + } } |