mirror of
git://git.suckless.org/sbase
synced 2026-01-26 13:43:17 +00:00
ed: Use the variable LINES for z
Some shells keep a variable LINES with the number of lines of the terminal updated in every SIGWINCH. Using that variable makes easier to get a full listing.
This commit is contained in:
parent
60d9f7a5a9
commit
4bc4a1d030
7
ed.1
7
ed.1
@ -1,4 +1,4 @@
|
||||
.Dd December 27, 2025
|
||||
.Dd December 31, 2025
|
||||
.Dt ED 1
|
||||
.Os sbase
|
||||
.Sh NAME
|
||||
@ -233,7 +233,10 @@ lines starting at the addressed line.
|
||||
If
|
||||
.Ar n
|
||||
is not specified then
|
||||
it is defaulted to 24.
|
||||
the value of $LINES - 1 is used.
|
||||
If the value of
|
||||
.Ar n
|
||||
is 0 or negative then the default value of 23 is used.
|
||||
.It ($)=
|
||||
Print the line number of the addressed line.
|
||||
The dot is unchanged.
|
||||
|
||||
9
ed.c
9
ed.c
@ -1270,6 +1270,7 @@ subst(int nth)
|
||||
static void
|
||||
docmd(void)
|
||||
{
|
||||
char *var;
|
||||
int cmd, c, line3, num, trunc;
|
||||
|
||||
repeat:
|
||||
@ -1406,10 +1407,14 @@ repeat:
|
||||
case 'z':
|
||||
if (nlines > 1)
|
||||
goto bad_address;
|
||||
|
||||
num = 0;
|
||||
if (isdigit(back(input())))
|
||||
num = getnum();
|
||||
else
|
||||
num = 24;
|
||||
else if ((var = getenv("LINES")) != NULL)
|
||||
num = atoi(var) - 1;
|
||||
if (num <= 0)
|
||||
num = 23;
|
||||
chkprint(1);
|
||||
deflines(curln, curln);
|
||||
scroll(num);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user