Skip to content

Commit

Permalink
fix: apply scan codes on insert mode
Browse files Browse the repository at this point in the history
  • Loading branch information
estin committed Jan 6, 2025
1 parent 6c9619d commit 76f939a
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 3 deletions.
56 changes: 53 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions helix-term/src/ui/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,34 @@ impl EditorView {
) -> Option<KeymapResult> {
let mut last_mode = mode;
self.pseudo_pending.extend(self.keymaps.pending());

let key_result = self.keymaps.get(mode, event);

#[cfg(feature = "scancode")]
let key_result = {
if !matches!(
key_result,
KeymapResult::NotFound | KeymapResult::Cancelled(_)
) {
key_result
} else {
match key_result {
KeymapResult::NotFound => {
self.keymaps.get(mode, cxt.editor.scancode_apply(event))
}
KeymapResult::Cancelled(mut keys) => {
// replay keys previous keys and try again by scancode key
let _ = keys.pop();
for key in keys {
let _ = self.keymaps.get(mode, key);
}
self.keymaps.get(mode, cxt.editor.scancode_apply(event))
}
_ => unreachable!(),
}
}
};

cxt.editor.autoinfo = self.keymaps.sticky().map(|node| node.infobox());

let mut execute_command = |command: &commands::MappableCommand| {
Expand Down

0 comments on commit 76f939a

Please sign in to comment.