From bc818d9222ab69a4bbb876d5843dcc4874accd48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 18 Jan 2017 14:56:57 +0100 Subject: vis: support count for insertion and replacement Fix #372 --- vis-modes.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'vis-modes.c') 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) { -- cgit v1.2.3