summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/sed/process.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c
index 4674404..1ba80f5 100644
--- a/usr.bin/sed/process.c
+++ b/usr.bin/sed/process.c
@@ -360,6 +360,9 @@ substitute(cp)
s += match[0].rm_eo;
slen -= match[0].rm_eo;
lastempty = 0;
+ } else if (match[0].rm_so == slen) {
+ s += match[0].rm_so;
+ slen = 0;
} else {
if (match[0].rm_so == 0)
cspace(&SS, s, match[0].rm_so + 1,
OpenPOWER on IntegriCloud