From: Mika Liljeberg (liljeber@hydra.Helsinki.FI)
Date: 11/05/92


From: liljeber@hydra.Helsinki.FI (Mika Liljeberg)
Subject: Re: linux-0.98.3 termcap problem
Date: 5 Nov 1992 20:22:26 GMT

In article <92308.071727NU013809@NDSUVM1.BITNET> NU013809@NDSUVM1.BITNET (Greg Wettstein) wrote:
> Speaking of TERMCAP problems I am wondering if anyone has noticed this yet.
>
> According to the discussions here and on the mailing list I decided to
> always refer to our Linux machines as VT220's when I logged onto other
> systems which use TERMCAP style entries. console is great for Linux but of
> course unknown to other systems.
>
> After logging into a couple of systems I suddenly noticed that the virtual
> console was restricting itself to 24 lines. For example if less is used
> to view a file and the sh prompt is on the bottom line of the screen the
> entire output gets displayed on the bottom line of the screen. Using
> less with the prompt at the top of the screen causes less to use the
> console as if it had 24 lines.

Yes, this is because the remote host _knows_ a VT220 has only 24
lines. The reset (rs) or initialization (is) string in the remote
host's termcap probably does something like this: "\E[1;24r". This
sets up the vtxxx scrolling region. 24 lines. Ugh.

I usually handle this problem by putting the following line into my
.login (on the remot host, of course):

eval "`resize`"

Resize comes with X11. It resets the scrolling region, finds out the
size of a VTxxx compatible display and sets the TERMCAP environment
variable and the tty settings accordingly. Nota that this _only_ works
for VTxxx compatible terminals. If you frequently use something more
exotic, you should let tset recognize the terminal first and then do
something like this:

if ($TERM == "vt100") eval "`resize`"

The Linux console will identify itself as a vt102, if asked. Some tset
programs set the TERM variable to vt100, some set it to vt102. Check
out what yours does.

> Just a quick comment, perhaps the setterm code/console driver needs to be
> modified to recognize some type of absolute reset sequence. I would
> envision this sequence resetting the virtual console from which it was
> invoked to the same condition it would be in after a boot sequence. This
> would be helpful in this case and also in the case when garbage gets
> dumped to the screen causing selection of the alternate character set.

There already is one. Even a dumb vt100 knows how to reset itself. The
control sequence is ESC c. Put this into your (linux) termcap:

rs=\Ec

Now "setterm -reset" will reset the virtual console to the power-on
defaults (except for some colour settings, which are not really part
of the terminal emulation). If you only want to reset the scrolling
region, the sequence for that is "\E[r".

Well, I hope this helps.

        Mika