summaryrefslogtreecommitdiff
path: root/helix-term/src/ui/editor.rs
diff options
context:
space:
mode:
authorMehdi Abedi2024-02-14 10:53:15 +0000
committerGitHub2024-02-14 10:53:15 +0000
commit4df08ddbe02f1e8d84c6aa4be810a91f83c73441 (patch)
treee7b76a3d51140e7a8b279023986fd337ac2fe447 /helix-term/src/ui/editor.rs
parentc59f29921da98e23525c9ff4ffa82e330310e6fe (diff)
Allow numbers as second input event (#8471)
* Make sure pending key list is empty when count handling This will allow using numbers as second key event. * count handling; add an exception for 'g' * Lookup the key event before considering a number as count * Avoid the allocation of another vec for the pending keys --------- Co-authored-by: x <x@torrent>
Diffstat (limited to 'helix-term/src/ui/editor.rs')
-rw-r--r--helix-term/src/ui/editor.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index fef62a29..bb749d2e 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -903,7 +903,9 @@ impl EditorView {
fn command_mode(&mut self, mode: Mode, cxt: &mut commands::Context, event: KeyEvent) {
match (event, cxt.editor.count) {
// count handling
- (key!(i @ '0'), Some(_)) | (key!(i @ '1'..='9'), _) => {
+ (key!(i @ '0'), Some(_)) | (key!(i @ '1'..='9'), _)
+ if !self.keymaps.contains_key(mode, event) =>
+ {
let i = i.to_digit(10).unwrap() as usize;
cxt.editor.count =
std::num::NonZeroUsize::new(cxt.editor.count.map_or(i, |c| c.get() * 10 + i));