Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly handle case where last character in a cancelled command begins a new command #6960

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Explicitly re-process final character
  • Loading branch information
Sam committed May 3, 2023
commit df52fea84bd8bc62da7e754252d1d6f1f8c7ee10
11 changes: 10 additions & 1 deletion helix-term/src/ui/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,8 @@ impl EditorView {
commands::insert::insert_char(cx, ch)
}
}
KeymapResult::Cancelled(pending) => {
KeymapResult::Cancelled(mut pending) => {
let last_evt = pending.pop().unwrap();
for ev in pending {
match ev.char() {
Some(ch) => commands::insert::insert_char(cx, ch),
Expand All @@ -866,6 +867,14 @@ impl EditorView {
}
}
}
match self.handle_keymap_event(Mode::Insert, cx, last_evt) {
Some(KeymapResult::NotFound) => {
if let Some(ch) = last_evt.char() {
commands::insert::insert_char(cx, ch)
}
}
_ => (),
}
}
_ => unreachable!(),
}
Expand Down