fix: repeating repeat operator (#4450)

pull/4478/head
Michał Zabielski 2 years ago committed by GitHub
parent 9fae4b8118
commit 65edf9c198
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -25,7 +25,7 @@ use helix_view::{
keyboard::{KeyCode, KeyModifiers},
Document, Editor, Theme, View,
};
use std::{borrow::Cow, cmp::min, path::PathBuf};
use std::{borrow::Cow, cmp::min, num::NonZeroUsize, path::PathBuf};
use tui::buffer::Buffer as Surface;
@ -1009,6 +1009,7 @@ impl EditorView {
}
// special handling for repeat operator
(key!('.'), _) if self.keymaps.pending().is_empty() => {
for _ in 0..cxt.editor.count.map_or(1, NonZeroUsize::into) {
// first execute whatever put us into insert mode
self.last_insert.0.execute(cxt);
// then replay the inputs
@ -1041,6 +1042,8 @@ impl EditorView {
}
}
}
cxt.editor.count = None;
}
_ => {
// set the count
cxt.count = cxt.editor.count;

Loading…
Cancel
Save