[comp.unix] Curses scrolling

usenet@mcdchg.UUCP (10/22/87)

The identifiers in caps are masks for the flags word in the window
structure; the others are elements of the same structure.  There is
also an array or two that tells which lines were changed, and how much
of each line was changed.  Touchwin() marks these to show all of every
line changed.  Names and uses are generally version-dependent.

I think you're asking the questions backwards.  If your curses has an
IDLINE mask, you can probably get what you want using idlok(win,TRUE);
that should set IDLINE and thus activate insert/delete line, which also
activates hardware scrolling.  I have a more difficult problem: how to
force hardware scrolling, with a terminal without insert/delete line,
in a curses that does not support the idlok() function.

To do what you describe, you should be aware that curses not only keeps
a map of each window (e.g., "stdscr") before updating, it also keeps a
map in a window called "curscr"	of how the screen looks after
updating.  It uses this map, for instance, if you refresh(curscr) in
response to receiving CTRL-L.  So you would also have to scroll(curscr),
assuming your curses allows that call.  If you don't, then on the next
refresh(win) curses will compare win with curscr and repaint the screen.

To understand why curses doesn't always use hardware scrolling when
it's defined in terminfo or termcap, just keep in mind that curses does
not remember what functions led up to the configuration of your
window.  If you scroll(win), it simply does a logical scroll of win.
Then when you wrefresh(win), it can't use hardware scrolling unless it
compares win with curscr to find matching lines in different positions,
so it can decide whether sending a hardware scroll is more efficient
than repainting the screen.  Unless otherwise instructed, it skips
those comparisons and just repaints.

I do some work on a UNIX(tm) system in which curses does not support
idlok().  In that system, curses does hardware scrolling only if the
terminal has insert-line and delete-line capabilities, because the same
line-to-line comparison algorithm is used for deciding how to use all
three capabilities: insert-line, delete-line, and scrolling.  I have a
terminal with both forward and reverse scrolling capability, but no
insert- or delete-line capability.  With that terminal, vi uses forward
and reverse scrolling, but curses uses neither.  Can I make that old
curses use hardware scrolling with my terminal?
-- 
M. B. Brilliant					Marty
AT&T-BL HO 3D-520	(201)-949-1858
Holmdel, NJ 07733	ihnp4!houdi!marty1