diff options
author | Blaž Hrastnik | 2022-03-20 06:50:48 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-03-20 07:03:13 +0000 |
commit | 7909d6f05e4d651d904886aa53ec4bd250294e73 (patch) | |
tree | 915d6196e9e091bf2a997507c7d5d770ac02bb82 /helix-term/src/ui | |
parent | cfd992b1511655fc2116af4ddd1cd0dbb3bcb85e (diff) |
keymap: Store pending/sticky on the root level
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r-- | helix-term/src/ui/editor.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 2b9de5d6..a0c0e773 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -703,7 +703,7 @@ impl EditorView { event: KeyEvent, ) -> Option<KeymapResult> { cxt.editor.autoinfo = None; - let key_result = self.keymaps.get_mut(&mode).unwrap().get(event); + let key_result = self.keymaps.get(mode, event); cxt.editor.autoinfo = key_result.sticky.map(|node| node.infobox()); match &key_result.kind { @@ -733,7 +733,7 @@ impl EditorView { Some(ch) => commands::insert::insert_char(cx, ch), None => { if let KeymapResultKind::Matched(command) = - self.keymaps.get_mut(&Mode::Insert).unwrap().get(ev).kind + self.keymaps.get(Mode::Insert, ev).kind { command.execute(cx); } @@ -1182,12 +1182,11 @@ impl Component for EditorView { // how we entered insert mode is important, and we should track that so // we can repeat the side effect. - self.last_insert.0 = - match self.keymaps.get_mut(&mode).unwrap().get(key).kind { - KeymapResultKind::Matched(command) => command, - // FIXME: insert mode can only be entered through single KeyCodes - _ => unimplemented!(), - }; + self.last_insert.0 = match self.keymaps.get(mode, key).kind { + KeymapResultKind::Matched(command) => command, + // FIXME: insert mode can only be entered through single KeyCodes + _ => unimplemented!(), + }; self.last_insert.1.clear(); } (Mode::Insert, Mode::Normal) => { |