[comp.sys.att] changing unix-pc's idea of window size

kak@hico2.UUCP (Kris A. Kugel) (08/01/90)

Well, I found a small font to load into those undersized 3b1 windows.
When I use the vi editor, however, only a limited section of the window
window is used.   How can I change the size that the window thinks it is?
                               Kris A. Kugel
                              (201) 842-2707
       {uunet,att,rutgers}!westmark!hico2!kak  <--well-connected
		    {tsdiag,ka2qhd}!hico2!kak  <--frequent
{ssbn,zorch,zinn,ditka,daver,attdso}!hico2!kak <--semi-daily

tkacik@rphroy.uucp (Tom Tkacik) (08/03/90)

In article <232@hico2.UUCP>, kak@hico2.UUCP (Kris A. Kugel) writes:
|> Well, I found a small font to load into those undersized 3b1 windows.
|> When I use the vi editor, however, only a limited section of the window
|> window is used.   How can I change the size that the window thinks it is?
You have to change the TERMCAP environment variable in your shell.  This
defines the number of lines and columns in the window, among other things.

Some programs, (I do not think vi is one), also require that the environment
variables LINES, and COLUMNS must be made to match the size of the screen.

I have written a short program, (which I call sz), which will set these for
you.  Maybe it's time to clean it up, and post it.  
Is there interest?

A program cannot change the environment of its parent, so you actually type
$ eval `sz`

--
Tom Tkacik				...uunet!edsews!rphroy!tkacik
GM Research Labs			tkacik@kyzyl.mi.org
"I'm president of the United States, and I'm not going to eat anymore
broccoli."
						--- George Bush

yarvin-norman@cs.yale.edu (Norman Yarvin) (08/03/90)

In article <232@hico2.UUCP> kak@hico2.UUCP (Kris A. Kugel) writes:
>Well, I found a small font to load into those undersized 3b1 windows.
>When I use the vi editor, however, only a limited section of the window
>window is used.   How can I change the size that the window thinks it is?

There are two different systems programs use for determining window size:
terminfo (System 5) and termcap (BSD).  The Unix PC has both; some programs
that come with the system (e.g. more) use termcap and other programs use
terminfo.

Both of these systems use the environment variable TERM to determine the
terminal type; each terminal type has a terminal description, stored in
/etc/termcap (for termcap) or in /usr/lib/terminfo/*/* (one file per
terminal) for terminfo.  The terminal description specifies the screen size.
Thus it is possible to change your window size by making one terminal
description for each size you want.  This is a pain.

Both termcap and terminfo have ways to override the size in the terminal
description.  For terminfo, you set the environment variables LINES and
COLUMNS.  For termcap, you set the environment variable TERMCAP.  TERMCAP
can be set to a name of a file, in which case termcap looks in that file
rather than in /etc/termcap for terminal descriptions; TERMCAP can also be
set to a terminal description.

So to resize your window, set your environment up with:

LINES=24			# or whatever
COLUMNS=80
TERMCAP=vs|xterm|vs100|xterm terminal emulator (X window system):
:cr=^M:do=^J:nl=^J:bl=^G:le=^H:ho=\E[H:cl=\E[H\E[2J:
:bs:am:cm=\E[%i%d;%dH:nd=\E[C:up=\E[A:ce=\E[K:cd=\E[J:so=\E[7m:se=\E[m:
us=\E[4m:ue=\E[m:md=\E[1m:mr=\E[7m:me=\E[m:ku=\EOA:kd=\EOB:kr=
\EOC:kl=\EOD:kb=^H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:ta=^I:pt:sf=\n:sr=\E
M:al=\E[L:dl=\E[M:ic=\E[@:dc=\E[P:MT:ks=\E[?1h\E=:ke=\E[?1l\E>
:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l:rs=\E[r\E<\E[m\E[2J\E[
H\E[?7h\E[?1;3;4;6l:xn:AL=\E[%dL:DL=\E[%dM:IC=\E[%d@:DC=\E[%dP:
:ti=\E7\E[?47h:te=\E[2J\E[?47l\E8:hs:ts=\E[?E\E[?%i%dT:fs=\E[?F:es
:ds=\E[?E:li#24:co#80:		# replace this with a unix pc termcap entry
				# and take out the newlines
export LINES COLUMNS TERMCAP

I am aware of two programs that get the current window size and set up these
variables; one is called "sz" or "rsz" or something, and the other is my
"wind" program, a small command interpreter which opens windows and runs
processes in them.

--
Norman Yarvin					yarvin-norman@cs.yale.edu