[fa.info-mac] Notes on terminal emulation

info-mac@uw-beaver (info-mac) (08/31/84)

From: Richard Garland <OC.GARLAND%CU20B@COLUMBIA>
A few responses to recent comments on MacTerminal's terminal emulation:

Character/Line Insert/Delete

Is was noted that some editors can simulate line insert/delete by setting
the scrolling region on the VT100.  Efficiency-wise we have the following

	Set scrolling region	-	6 - 8 characters transmitted
	Index or reverse index	-	2 characters per line

So if an editor "opens a line" it must send 16 characters of control
(on average call set region 7).  An insert line is 4 characters.  If
the editor is "smart" it will not reset the scroll region until it sees
that the user is not going to open additional lines.  The for n consecutive
lines inserted we get (2*n + 14) with the scrolling region method, vs
4*n using insert line (doing it one at a time).  For relatively long
lines (say 40 - 50 characters) this is a reasonable simulation resulting
in about a 15 - 20 % increase in characters transmitted.  Obviously
repainting the whole bottom of the page on terminals without settable
scrolling regions it is much worse.

For Character inserts We have 4 characters to Set-mode to insert mode,
and 4 more to set back to replacement mode.  This overhead or 8 must be 
compared to rewritting the end of a line (on each keystroke).   This
could be a much greater saveing.  If you want to insert 5 characters
in the middle of a 50 character line you get 12 characters transmitted
using Insert-Character vs 130 characters for repainting.

Clearly Insert-Character is a much bigger win then insert line (at least
if the emulation can set the scrolling region).

Note on Mouse pseudo arrows:  it was noted that moving the mouse to a
screen position resulted in a sequence of arrows which first went to
the left margin, then went to the appropriate line, then went to the
appropriate column.  Although this is admittedly less than direct, it
will more likely work with a variety of screen editors.  I have a version
of Emacs for example which will not go back to the column in a long
line if a short line intervenes:  ie if I start at column 50, hit down arrow
a bunch of times and an intervening line is say 20 characters long, then
once it gets to that short line it stays in column 20.  You may say:
"thats dumb - fix your editor".  Sure ...  So the method used in
MacTerminal is a win for me in this case.   Maybe if you optimize it,
make a settable option to keep doing it the "dumb" way.

					Rg
-------