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.
This commit is contained in:
Roberto E. Vargas Caballero 2015-12-16 20:18:09 +01:00 committed by sin
parent 3e130cee66
commit 694a5ef7fb

2
ed.c
View File

@ -991,10 +991,10 @@ subline(int num, int nth)
siz = 0; siz = 0;
for (m = match(num); m; m = rematch(num)) { for (m = match(num); m; m = rematch(num)) {
addpre(&s, &cap, &siz);
if (--nth > 0) if (--nth > 0)
continue; continue;
changed = 1; changed = 1;
addpre(&s, &cap, &siz);
addsub(&s, &cap, &siz); addsub(&s, &cap, &siz);
if (nth == 0) if (nth == 0)
break; break;