|
|
@ -549,7 +549,7 @@ pub fn parse_macro(keys_str: &str) -> anyhow::Result<Vec<KeyEvent>> {
|
|
|
|
if c == ">" {
|
|
|
|
if c == ">" {
|
|
|
|
keys_res = Err(anyhow!("Unmatched '>'"));
|
|
|
|
keys_res = Err(anyhow!("Unmatched '>'"));
|
|
|
|
} else if c != "<" {
|
|
|
|
} else if c != "<" {
|
|
|
|
keys.push(c);
|
|
|
|
keys.push(if c == "-" { keys::MINUS } else { c });
|
|
|
|
i += end_i;
|
|
|
|
i += end_i;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
match s.find('>').context("'>' expected") {
|
|
|
|
match s.find('>').context("'>' expected") {
|
|
|
@ -813,6 +813,64 @@ mod test {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
])
|
|
|
|
])
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
|
|
parse_macro(":w aa-bb.txt<ret>").ok(),
|
|
|
|
|
|
|
|
Some(vec![
|
|
|
|
|
|
|
|
KeyEvent {
|
|
|
|
|
|
|
|
code: KeyCode::Char(':'),
|
|
|
|
|
|
|
|
modifiers: KeyModifiers::NONE,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
KeyEvent {
|
|
|
|
|
|
|
|
code: KeyCode::Char('w'),
|
|
|
|
|
|
|
|
modifiers: KeyModifiers::NONE,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
KeyEvent {
|
|
|
|
|
|
|
|
code: KeyCode::Char(' '),
|
|
|
|
|
|
|
|
modifiers: KeyModifiers::NONE,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
KeyEvent {
|
|
|
|
|
|
|
|
code: KeyCode::Char('a'),
|
|
|
|
|
|
|
|
modifiers: KeyModifiers::NONE,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
KeyEvent {
|
|
|
|
|
|
|
|
code: KeyCode::Char('a'),
|
|
|
|
|
|
|
|
modifiers: KeyModifiers::NONE,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
KeyEvent {
|
|
|
|
|
|
|
|
code: KeyCode::Char('-'),
|
|
|
|
|
|
|
|
modifiers: KeyModifiers::NONE,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
KeyEvent {
|
|
|
|
|
|
|
|
code: KeyCode::Char('b'),
|
|
|
|
|
|
|
|
modifiers: KeyModifiers::NONE,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
KeyEvent {
|
|
|
|
|
|
|
|
code: KeyCode::Char('b'),
|
|
|
|
|
|
|
|
modifiers: KeyModifiers::NONE,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
KeyEvent {
|
|
|
|
|
|
|
|
code: KeyCode::Char('.'),
|
|
|
|
|
|
|
|
modifiers: KeyModifiers::NONE,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
KeyEvent {
|
|
|
|
|
|
|
|
code: KeyCode::Char('t'),
|
|
|
|
|
|
|
|
modifiers: KeyModifiers::NONE,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
KeyEvent {
|
|
|
|
|
|
|
|
code: KeyCode::Char('x'),
|
|
|
|
|
|
|
|
modifiers: KeyModifiers::NONE,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
KeyEvent {
|
|
|
|
|
|
|
|
code: KeyCode::Char('t'),
|
|
|
|
|
|
|
|
modifiers: KeyModifiers::NONE,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
KeyEvent {
|
|
|
|
|
|
|
|
code: KeyCode::Enter,
|
|
|
|
|
|
|
|
modifiers: KeyModifiers::NONE,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|