vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 77ed82d0ed431f62cc225dfbeb3fab066d8fb9a4 parent b1cf3e08f9c14cd89830cb169a2559e533f904a9 Author: Marc André Tanner <mat@brain-dump.org> Date: Tue, 23 Feb 2016 00:07:58 +0100 Make f, F, t, T motion work when replaying a macro Diffstat:
| M | main.c | | | 15 | +++++++++------ |
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git 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; }