From 08d686d991cce58a22b4841010feae0e38dbe3d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 23 Feb 2016 00:07:58 +0100 Subject: Make f, F, t, T motion work when replaying a macro --- main.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index 66e3402..6cd7d18 100644 --- a/main.c +++ b/main.c @@ -1347,13 +1347,16 @@ static const char *operator_filter(Vis *vis, const char *keys, const Arg *arg) { } static const char *movement_key(Vis *vis, const char *keys, const Arg *arg) { - if (!keys[0]) - return NULL; char key[32]; - const char *next = vis_keys_next(vis, keys); - strncpy(key, keys, next - keys + 1); - key[sizeof(key)-1] = '\0'; - vis_motion(vis, arg->i, key); + const char *next; + if (!keys[0] || !(next = vis_keys_next(vis, keys))) + return NULL; + size_t len = next - keys; + if (len < sizeof key) { + strncpy(key, keys, len); + key[len] = '\0'; + vis_motion(vis, arg->i, key); + } return next; } -- cgit v1.2.3