vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 7d132474e2261e84c2ae499bed8f692d0ccd659f
parent 72688447aa5811e1be4cee0a83bcf50c1ffaccda
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Mon, 14 Sep 2015 21:52:10 +0200

vis: adapt r (replace) to new input handling

Diffstat:
Mvis.c | 13+++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/vis.c b/vis.c @@ -997,15 +997,16 @@ static const char *cursors_remove(const char *keys, const Arg *arg) { } static const char *replace(const char *keys, const Arg *arg) { - const char *key = getkey(); - if (!key) - return keys; + if (!keys[0]) + return NULL; + const char *next = utfnext(keys+1); + size_t len = next - keys; action_reset(&vis->action_prev); vis->action_prev.op = &ops[OP_REPEAT_REPLACE]; - buffer_put(&vis->buffer_repeat, key, strlen(key)); - editor_replace_key(vis, key, strlen(key)); + buffer_put(&vis->buffer_repeat, keys, len); + editor_replace_key(vis, keys, len); text_snapshot(vis->win->file->text); - return keys; + return next; } static const char *count(const char *keys, const Arg *arg) {