[net.bugs.4bsd] bug in VT100 termcap entry

bobvan (10/21/82)

We have many VT100's that get used in 132 column mode.  A user recently
reported that the '$' (move cursor to end of line) command of vi did not
work for long lines.  I traced the problem to a faulty description of
the cursor motion sequence for VT100's in /etc/termcap.  It used to read:

	cm=5\E[%i%2;%2H
		  ^  ^
Now it reads:     |  |
		  v  v
	cm=5\E[%i%d;%dH

The two character field width used in the old description would not
allow the cursor to go past column 99.

This description also frequently sent more characters than were
necessary to do cursor motion.  The VT100 allows any number of digits
for the cursor coordinates -- leading zeroes are not necessary.  Hence
the %2 format caused any motion to lines 1-9 or columns 1-9 to have
unneeded characters.

In conclusion, if your terminal does not require leading zeroes and your
termcap generates them, you should remedy this now.  It will speed up
cursor motion and allow operation with larger screen sizes in the future.

				Bob Van Valzah
				(...!decvax!ittvax!tpdcvax!bobvan)