Introduction
Introduction Statistics Contact Development Disclaimer Help
tex: fix s/$/x/g - neatvi - [fork] simple vi-type editor with UTF-8 support
git clone git://src.adamsgaard.dk/neatvi
Log
Files
Refs
README
---
commit 29df1c140f074dbd0a4d61baa7256866ba32051c
parent 2c0f3f357bcd4446492330f2313464c3c6348343
Author: Ali Gholami Rudi <[email protected]>
Date: Sat, 20 Nov 2021 22:27:24 +0330
ex: fix s/$/x/g
Diffstat:
M ex.c | 4 ++--
A test/v21.sh | 10 ++++++++++
2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/ex.c b/ex.c
t@@ -637,10 +637,10 @@ static int ec_substitute(char *loc, char *cmd, char *arg)
sbuf_mem(r, ln, offs[0]);
replace(r, xrep, ln, offs);
ln += offs[1];
- if (!*ln || !strchr(s, 'g'))
- break;
if (offs[1] <= 0) /* zero-length match */
sbuf_chr(r, (unsigned char) *ln++);
+ if (!*ln || *ln == '\n' || !strchr(s, 'g'))
+ break;
}
if (r) {
sbuf_str(r, ln);
diff --git a/test/v21.sh b/test/v21.sh
t@@ -0,0 +1,10 @@
+# vi commands
+echo ":e $1"
+echo "i"
+echo "oa"
+echo ":%s/$/x/g"
+echo ":wq"
+
+# the expected output
+echo "x" >&2
+echo "ax" >&2
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.