tex: replacing zero-length matches - neatvi - [fork] simple vi-type editor with UTF-8 support
HTML git clone git://src.adamsgaard.dk/neatvi
DIR Log
DIR Files
DIR Refs
DIR README
---
DIR commit 7dc3f15c183b10d3611be8a0e6fe5f0f7ae22df3
DIR parent 42fcac2533ea9fada01715d163a13d8ea7009465
HTML Author: Ali Gholami Rudi <ali@rudi.ir>
Date: Fri, 23 Feb 2018 01:16:52 +0330
ex: replacing zero-length matches
Diffstat:
M ex.c | 2 ++
1 file changed, 2 insertions(+), 0 deletions(-)
---
DIR diff --git a/ex.c b/ex.c
t@@ -719,6 +719,8 @@ static int ec_substitute(char *ec)
sbuf_mem(r, ln, offs[0]);
replace(r, rep, ln, offs);
ln += offs[1];
+ if (offs[1] <= 0)
+ sbuf_chr(r, (unsigned char) *ln++);
if (!strchr(s, 'g'))
break;
}