From 75ff22469b21e72a4c9126d89cfa3623af1784fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 22 Feb 2017 09:28:40 +0100 Subject: vis: add exact count motion flag Some motions should fail (i.e. keep the initial position) when the specified count can not be satisfied exactly. Examples include t, f, T, and F. Fix #497 --- vis.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'vis.c') diff --git a/vis.c b/vis.c index 58c1a5c..aaead35 100644 --- a/vis.c +++ b/vis.c @@ -710,6 +710,7 @@ void vis_do(Vis *vis) { .arg = &a->arg, }; + bool err = false; if (a->movement) { size_t start = pos; for (int i = 0; i < count; i++) { @@ -728,8 +729,15 @@ void vis_do(Vis *vis) { pos = a->movement->win(vis, win, pos); else if (a->movement->user) pos = a->movement->user(vis, win, a->movement->data, pos); - if (pos == EPOS || a->movement->type & IDEMPOTENT || pos == pos_prev) + if (pos == EPOS || a->movement->type & IDEMPOTENT || pos == pos_prev) { + err = a->movement->type & COUNT_EXACT; break; + } + } + + if (err) { + repeatable = false; + continue; // break? } if (pos == EPOS) { -- cgit v1.2.3