Improve doglobal()
Don't use directly the line numbers and call to getlst() when a line is matched.
This commit is contained in:
parent
9781959581
commit
ebf740f962
30
ed.c
30
ed.c
|
@ -1318,7 +1318,7 @@ chkglobal(void)
|
||||||
static void
|
static void
|
||||||
doglobal(void)
|
doglobal(void)
|
||||||
{
|
{
|
||||||
int i, k;
|
int cnt, ln, k;
|
||||||
|
|
||||||
skipblank();
|
skipblank();
|
||||||
cmdline.siz = 0;
|
cmdline.siz = 0;
|
||||||
|
@ -1326,18 +1326,24 @@ doglobal(void)
|
||||||
if (uflag)
|
if (uflag)
|
||||||
chkprint(0);
|
chkprint(0);
|
||||||
|
|
||||||
for (i = 1; i <= lastln; i++) {
|
ln = line1;
|
||||||
k = getindex(i);
|
for (cnt = 0; cnt < lastln; ) {
|
||||||
if (!zero[k].global)
|
k = getindex(ln);
|
||||||
continue;
|
if (zero[k].global) {
|
||||||
curln = i;
|
zero[k].global = 0;
|
||||||
nlines = 0;
|
curln = ln;
|
||||||
if (uflag) {
|
nlines = 0;
|
||||||
line1 = line2 = i;
|
if (uflag) {
|
||||||
pflag = 0;
|
line1 = line2 = ln;
|
||||||
doprint();
|
pflag = 0;
|
||||||
|
doprint();
|
||||||
|
}
|
||||||
|
getlst();
|
||||||
|
docmd();
|
||||||
|
} else {
|
||||||
|
cnt++;
|
||||||
|
ln = nextln(ln);
|
||||||
}
|
}
|
||||||
docmd();
|
|
||||||
}
|
}
|
||||||
discard(); /* cover the case of not matching anything */
|
discard(); /* cover the case of not matching anything */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user