tex: replacing zero-length matches - neatvi - [fork] simple vi-type editor with… | |
git clone git://src.adamsgaard.dk/neatvi | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit 7dc3f15c183b10d3611be8a0e6fe5f0f7ae22df3 | |
parent 42fcac2533ea9fada01715d163a13d8ea7009465 | |
Author: Ali Gholami Rudi <[email protected]> | |
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(-) | |
--- | |
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; | |
} |