sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

commit 2d4d7dc6d46ed7d227d49110196846d72f095d4b
parent 516e7fec92c5e0b8ec031abeda62903b0d255c37
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed,  6 Dec 2023 00:38:49 +0100

ed: Fix G and V commands

Diffstat:
Med.c | 30+++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/ed.c b/ed.c @@ -1242,7 +1242,6 @@ repeat: trunc = pflag = 0; switch (cmd) { case '&': - /* This is not working now */ skipblank(); chkprint(0); if (!ocmdline) @@ -1254,8 +1253,6 @@ repeat: execsh(); break; case '\0': - if (gflag && uflag) - return; num = gflag ? curln : curln+1; deflines(num, num); pflag = 'p'; @@ -1520,17 +1517,28 @@ doglobal(void) zero[k].global = 0; curln = ln; nlines = 0; - if (uflag) { - line1 = line2 = ln; - pflag = 0; - doprint(); + + if (!uflag) { + idx = inputidx; + getlst(); + docmd(); + inputidx = idx; + continue; + } + + line1 = line2 = ln; + pflag = 0; + doprint(); + + for (;;) { getinput(); + if (strcmp(cmdline.str, "") == 0) + break; savecmd(); + getlst(); + docmd(); } - idx = inputidx; - getlst(); - docmd(); - inputidx = idx; + } else { cnt++; ln = nextln(ln);