diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-02-23 00:07:58 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-02-23 00:07:58 +0100 |
| commit | 08d686d991cce58a22b4841010feae0e38dbe3d0 (patch) | |
| tree | 9049eceb73cc8567c490d1d02b8ce6f7076f9442 | |
| parent | 9859f7847ec75f9f032664eb3ef324cd243ce722 (diff) | |
| download | vis-08d686d991cce58a22b4841010feae0e38dbe3d0.tar.gz vis-08d686d991cce58a22b4841010feae0e38dbe3d0.tar.xz | |
Make f, F, t, T motion work when replaying a macro
| -rw-r--r-- | main.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -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; } |
