[comp.emacs] How Can I Enable the Use of Scroll Regions?

jlange@oracle.com (Jim Lange) (10/13/90)

In article <9010070031.AA02897@wubios.wustl.edu> david@WUBIOS.WUSTL.EDU (David J. Camp) writes:

   My terminal supports scroll regions, so that a single ansi escape
   sequence can scroll a region up or down.  I know that the 'less'
   program is using this feature properly.  Emacs, however, does not, 
   and redraws each character individually.  Is there any way I can
   instruct emacs to use this feature?  It would save me a lot of time.
   I am using the 'ansi' terminal type on SunOS 4.1.  -David-

There is a text file included with GNU emacs called TERMS
(/usr/local/emacs/etc/TERMS on my system) that describes specific termcap
entries that will enhance the performance of emacs.  Here is an excerpt
relating to scroll regions:


>*** New termcap strings ***
>
>Emacs supports certain termcap strings that are not described in the
>4.2 manual but appear to be standard in system V.  The one exception
>is `cS', which I invented.
>	
>`cs'    set scroll region.  Takes two parameters, the vertical
>	positions of the first line to include in the scroll region
>	and the last line to include in the scroll region.
>	Both parameters are origin-zero.  The effect of this
>	should be to cause a following insert-line or delete-line
>	not to move lines below the bottom of the scroll region.
>
>	This is not the same convention that Emacs version 16 used.
>	That is because I was led astray by unclear documentation
>	of the meaning of %i in termcap strings.  Since the termcap
>	documentation for `cs' is also unclear, I had to deduce the
>	correct parameter conventions from what would make the VT-100's
>	`cs' string work properly.  From an incorrect assumption about
>	%i, I reached an incorrect conclusion about `cs', but the result
>	worked correctly on the VT100 and ANSII terminals.  In Emacs
>	version 17, both `cs' and %i work correctly.
>
>	The version 16 convention was to pass, for the second parameter,
>	the line number of the first line beyond the end of the
>	scroll region.
>
>`cS'    set scroll region.  Differs from `cs' in taking parameters
>	differently.  There are four parameters:
>	1. Total number of lines on the screen.
>	2. Number of lines above desired scroll region.
>	3. Number of lines below (outside of) desired scroll region.
>	4. Total number of lines on the screen, like #1.
>	This is because an Ambassador needs the parameters like this.
>
>The Sun console should have these capabilities for good performance.
>	   :AL=\E[%dL:DL=\E[%dM:IC=\E[%d@:DC=\E[%dP:
>

I suspect that the 'ansi' terminal type is very generic, you might try vt100
or a custom termcap entry for your system.

I have noticed that when using the vt100 termcap entry (which does have a 'cs'
termcap string), emacs sometimes scrolls a region, but sometimes redraws lines
when scrolling would be more appropriate and I'm not sure why.

Jim Lange
Oracle Corporation