aboutsummaryrefslogtreecommitdiff
path: root/vis-modes.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-01-18 14:56:57 +0100
committerMarc André Tanner <mat@brain-dump.org>2017-01-18 15:40:07 +0100
commitbc818d9222ab69a4bbb876d5843dcc4874accd48 (patch)
tree3caf2aa40a66454c4ead8fc215f0e431c65f43ed /vis-modes.c
parent2cf304af420335d8e95e9e80559f19dd1dcf27bf (diff)
downloadvis-bc818d9222ab69a4bbb876d5843dcc4874accd48.tar.gz
vis-bc818d9222ab69a4bbb876d5843dcc4874accd48.tar.xz
vis: support count for insertion and replacement
Fix #372
Diffstat (limited to 'vis-modes.c')
-rw-r--r--vis-modes.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/vis-modes.c b/vis-modes.c
index a82c71b..6f861d9 100644
--- a/vis-modes.c
+++ b/vis-modes.c
@@ -138,9 +138,18 @@ bool vis_window_mode_map(Win *win, enum VisMode id, bool force, const char *key,
static void vis_mode_normal_enter(Vis *vis, Mode *old) {
if (old != mode_get(vis, VIS_MODE_INSERT) && old != mode_get(vis, VIS_MODE_REPLACE))
return;
+ macro_operator_stop(vis);
+ if (vis->action_prev.op == &vis_operators[VIS_OP_MODESWITCH] && !vis->repeat_input) {
+ vis->repeat_input = true;
+ if (vis->action_prev.count > 1) {
+ vis->action_prev.count--;
+ vis_repeat(vis);
+ vis->action_prev.count++;
+ }
+ vis->repeat_input = false;
+ }
/* make sure we can recover the current state after an editing operation */
vis_file_snapshot(vis, vis->win->file);
- macro_operator_stop(vis);
}
static void vis_mode_operator_input(Vis *vis, const char *str, size_t len) {