[comp.windows.x] insert character optimization for xterm termcap entry

leres@ace.ee.lbl.gov (Craig Leres) (08/18/88)

Description:
	Both the X10 and X11 versions of xterm support the ANSI
	standard IRM (insertion-replacement) mode. Meanwhile, the xterm
	termcap uses insert-character which is not (as) optimal when
	insert-mode is available.

Repeat-By:
	Enter vi and append "foo" to the first line. Position the
	cursor at the beginning of the line. Insert 60 k's using the
	command "60ik\E". Notice that the k's are inserted slowly.

Fix:
	Switch from insert-character to insert-mode; change "ic=\E[@"
	to "im=\E[4h:ei=\E[4l:mi"

jbs@fenchurch.MIT.EDU (Jeff Siegal) (08/18/88)

I would think that whether insert-mode should be preferred over insert
character would depend on the application.

It is unfortunate that the termcap language does not optimally
describe terminals (and terminal-emulators, of course) which have
both capabilities.

Jeff Siegal

leres@ace.ee.lbl.gov (Craig Leres) (08/19/88)

Jeff Siegal writes:
> I would think that whether insert-mode should be preferred over insert
> character would depend on the application.

I claim that for the "Unix" application, insert mode is preferred. The
termcap(5) manual entry agrees with me:

    [...]            Most terminals with a true insert mode will
    not  give  ic,  terminals  which  send  a sequence to open a
    screen position  should  give  it  here.   (Insert  mode  is
    preferable  to the sequence to open a position on the screen
    if your terminal  has  both.)  [...]

If you use the insert character sequence, the overhead for each
inserted character is 3 characters per character. If you use insert
mode, the overhead is 4 characters to enter insert mode and 4
characters to leave insert mode. So when you insert more than 2
characters, it's cheaper to use insert mode. But this assumes that you
always exit insert mode immediately after an insertion; since xterm
allows movement while in insert mode, you can delay switch back to
replacement mode. In some cases, you'll move somewhere else and do
another insertion and save the 4 character end insert mode and 4
character enter insert mode sequences. Vi works this way.

		Craig