Skip to content

Commit

Permalink
Add test for kitty protocol modifier key in vi mode (#831)
Browse files Browse the repository at this point in the history
  • Loading branch information
replcat authored Sep 24, 2024
1 parent d8b240a commit 2a57906
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/edit_mode/vi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,32 @@ mod test {
assert_eq!(result, ReedlineEvent::CtrlD);
}

#[test]
fn keybinding_with_super_modifier_test() {
let mut keybindings = default_vi_normal_keybindings();
keybindings.add_binding(
KeyModifiers::SUPER,
KeyCode::Char('$'),
ReedlineEvent::CtrlD,
);

let mut vi = Vi {
insert_keybindings: default_vi_insert_keybindings(),
normal_keybindings: keybindings,
mode: ViMode::Normal,
..Default::default()
};

let esc = ReedlineRawEvent::convert_from(Event::Key(KeyEvent::new(
KeyCode::Char('$'),
KeyModifiers::SUPER,
)))
.unwrap();
let result = vi.parse_event(esc);

assert_eq!(result, ReedlineEvent::CtrlD);
}

#[test]
fn non_register_modifier_test() {
let keybindings = default_vi_normal_keybindings();
Expand Down

0 comments on commit 2a57906

Please sign in to comment.