| www.delorie.com/gnu/docs/termcap/termcap_28.html | search |
![]() Buy the book! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Scrolling means moving the contents of the screen up or down one or more lines. Moving the contents up is forward scrolling; moving them down is reverse scrolling.
Scrolling happens after each line of output during ordinary output on most display terminals. But in an application program that uses termcap for random-access output, scrolling happens only when explicitly requested with the commands in this section.
Some terminals have a scroll region feature. This lets you limit the effect of scrolling to a specified range of lines. Lines outside the range are unaffected when scrolling happens. The scroll region feature is available if either `cs' or `cS' is present.
Since these terminal descriptions do define `sr', perhaps at one time the definition of `do' was different and it could be used for scrolling as well. But it isn't desirable to combine these two functions in one capability, since scrolling often requires more padding than simply moving the cursor down. Defining `sf' and `do' separately allows you to specify the padding properly. Also, all sources agree that `do' should not be relied on to do scrolling.
So the best approach is to add `sf' capabilities to the descriptions of these terminals, copying the definition of `do' if that does scroll.
Do not try to move the cursor outside the scroll region. The region remains set until explicitly removed. To remove the scroll region, use another `cs' command specifying the full height of the screen.
The cursor position is undefined after the `cs' command is set, so position the cursor with `cm' immediately afterward.
This capability is a GNU extension that was invented to allow the Ann Arbor Ambassador's scroll-region command to be described; it could also be done by putting non-Unix `%'-sequences into a `cs' string, but that would have confused Unix programs that used the `cs' capability with the Unix termcap. Currently only GNU Emacs uses the `cS' capability.
The terminal may be able to scroll even if it does not normally do so. If the `sf' capability is provided, it can be used for scrolling regardless of `ns'.
The `da' and `db' flags do not, strictly speaking, affect how to scroll. But programs that scroll usually need to clear the lines scrolled onto the screen, if these flags are present.
Any terminal description that defines `SF' should also define `sf'; likewise for `SR' and `sr'. However, many terminals can only scroll by one line at a time, so it is common to find `sf' and not `SF', or `sr' without `SR'.
Therefore, all programs that use the scrolling facilities should be prepared to work with `sf' in the case that `SF' is absent, and likewise with `sr'. On the other hand, an application program that uses only `sf' and not `SF' is acceptable, though slow on some terminals.
When outputting a scroll command with tputs, the nlines
argument should be the total number of lines in the portion of the screen
being scrolled. Very often these commands require padding proportional to
this number of lines. See section 1.5 Padding.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |