vis

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

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

commit ed040dcb59e6770863991283327701ca7ce674dc
parent b0302a240b7e744c7042efdd85927f43d9d5ee13
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Wed,  9 Nov 2016 22:10:04 +0100

vis: handle cancelation of `r` command

Do not alter the text if <Escape> is pressed instead of a regular
replacement character.

Diffstat:
Mmain.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/main.c b/main.c @@ -1647,6 +1647,9 @@ static const char *replace(Vis *vis, const char *keys, const Arg *arg) { memcpy(replacement, keys, len); replacement[len] = '\0'; + if (strcmp("<Escape>", replacement) == 0) + return next; + if (vis_mode_get(vis) == VIS_MODE_NORMAL) { int count = vis_count_get_default(vis, 1); vis_operator(vis, VIS_OP_CHANGE);