[comp.emacs] Annoying GNU Emacs screen painting problem

stratton@hpcupt1.HP.COM (Jim Stratton) (05/17/89)

I'm looking for a solution to a problem with the way emacs updates
the terminal screen that's very annoying.  My emacs version is 18.51;
the terminal is an hp2392a.

When I'm in my top window on the top line and press C-p to scroll up
one line, the status line and lower window (if any) jumps up ~10 lines
and then jumps down.  I get the same behavior when on the bottom line
using C-n to scroll down.  C-v and M-v do not cause this behavior.
I suspect that there is some terminal capability that hasn't been defined
(uses TERMINFO, not TERMCAP), or emacs is not configured correctly.
I don't use a .emacs file.  Any clues as to what I might try?

Thanks,
Jim Stratton 
hplabs.hp.com!hpcupt1!stratton
-----

jr@bbn.com (John Robinson) (05/18/89)

In article <6900004@hpcupt1.HP.COM>, stratton@hpcupt1 (Jim Stratton) writes:
>I'm looking for a solution to a problem with the way emacs updates
>the terminal screen that's very annoying.  My emacs version is 18.51;
>the terminal is an hp2392a.
>
>When I'm in my top window on the top line and press C-p to scroll up
>one line, the status line and lower window (if any) jumps up ~10 lines
>and then jumps down.  I get the same behavior when on the bottom line
>using C-n to scroll down.  C-v and M-v do not cause this behavior.
>I suspect that there is some terminal capability that hasn't been defined
>(uses TERMINFO, not TERMCAP), or emacs is not configured correctly.
>I don't use a .emacs file.  Any clues as to what I might try?

Look at $EMACS/etc/TERMS for some pointers.  Terminals that can do
multi-line insert and delete line (AL and DL capabilities) perform
much better.  Also, those with scrolling regions (cs capability).  If
these apply to your terminal, add them to its terminfo entry.  I
didn't see any of these in the various HP terminal termcap entries
lurking about on my machine.

Be sure your terminal speed (in stty) is accurate; with networks
betwen you and your host it may not be, and the costs of doing things
will come out wrong.  (By the same token, you may be able to "fool"
the cost computation by lying about how slow or fast your terminal is,
though if you say it's too slow the screen may get garbaged).

Emacs' display code (xdisp.c; abandon all hope who enter here)
computes a "cost" of both styles of update, and chooses the cheaper
one.  The cost is the number of characters to do the update, comparing
simply clearing the end of the screen and repainting to scrolling the
bottom up then down (with add/delete line) and painting only the lines
between.  From xdisp.c:

	  /* If reprinting everything is nearly as fast as scrolling,
	     don't bother scrolling.  Can happen if lines are short.  */

You may affect the cost computation by making add/delete line look
costlier, by increasing padding specs in the terminfo entries.  Or you
can remove the ability to add/delete lines altogther (capabilities al,
dl).  But, believe it or not, emacs is probably doing the fastest
update, despite appearances.  It may just be a little jarring to the
eyes.
--
/jr
jr@bbn.com or bbn!jr
C'mon big money!