vis

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

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

commit edf811159ad80684bba4915e6161ded58dda185e
parent 216b46da8504015379d29219a6242c723ad86e82
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Fri, 13 Jan 2017 17:02:38 +0100

sam: allow empty text specifiers

Before the i, a, c commands would fail when given an empty text //.

Diffstat:
Msam.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sam.c b/sam.c @@ -572,8 +572,11 @@ static char *parse_delimited(const char **s, int type) { static char *parse_text(const char **s) { skip_spaces(s); - if (**s != '\n') - return parse_delimited(s, CMD_TEXT); + if (**s != '\n') { + const char *before = *s; + char *text = parse_delimited(s, CMD_TEXT); + return (!text && *s != before) ? strdup("") : text; + } Buffer buf; buffer_init(&buf);