From 694a5ef7fbca54581a431a528972509c5a2e8bc0 Mon Sep 17 00:00:00 2001 From: "Roberto E. Vargas Caballero" Date: Wed, 16 Dec 2015 20:18:09 +0100 Subject: [PATCH] call to addpre() in every iteration of subline() It is needed to call to addpre(), because in other case the prefix of all the occurrences before the target will not be copied to the result string. --- ed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ed.c b/ed.c index 33b4837..c060e5f 100644 --- a/ed.c +++ b/ed.c @@ -991,10 +991,10 @@ subline(int num, int nth) siz = 0; for (m = match(num); m; m = rematch(num)) { + addpre(&s, &cap, &siz); if (--nth > 0) continue; changed = 1; - addpre(&s, &cap, &siz); addsub(&s, &cap, &siz); if (nth == 0) break;