Less Optimized Curses

Stacey Campbell staceyc at sco.COM
Thu Nov 15 05:15:08 AEST 1990


In article <1990Nov13.090732 at mathcs.emory.edu> km at mathcs.emory.edu (Ken Mandelberg) writes:
>This is an expansion on a problem I posted earlier about curses screen
>update optimization. The issue concerns how clever curses is in updating
>a screen to a new screen whoose contents are vertically displaced one
>line. What I notice is that almost all versions of curses don't notice
>the relationshsip between the screens, and repaint everything. One version
>of curses does notice the relationship, and updates the screen using
>scrolling.

Most modern versions of curses will not use insert line or delete line
to achieve scrolling unless they are explicitly requested to do so by
the application.

You will find that adding;

	idlok(stdscr, TRUE);

directly after the initscr() call will then permit System V 3.2 curses
to scroll using insert line/delete line.

Here's what the AT&T manual says (somewhat abridged);

idlok(win, bf)	If enabled, curses will consider using the hardware
	"insert/delete-line" feature of terminals so equipped.  If
	disabled, curses will very seldom use this feature [I have never
	seen it use this feature when disabled - Stacey].  It is
	disabled by default because "insert/delete-line" tends to be
	visually annoying when used in applications where it isn't really
	needed.

I agree with the manual writer, forcing scrolls in some situations
is very irritating to the eye.  It is definitely something that should
be only used when required.

>I report this partially because I am curious as to why libcurses got less
>optimized in recent versions.

It's not less optimised.  The opposite is in fact true.  It's only
in recent versions (System V 3.1 (?)) for example that typeahead
checking has been implemented.

>On the practical side, I would 
>like an old program that works well on 3.0 to work well on our later systems
>without a rewrite (sc the spreedsheet program).

No need to rewrite.  One of the first things I did to sc when I finally got
it compiled and running was to add the line idlok(stdscr, TRUE) in sc.c.
-- 
Stacey Campbell       staceyc at sco.com
{uunet,decwrl,ucscc,att,sq,altos,lotus,phoenix,sun,microsoft,xbs}!sco!staceyc



More information about the Comp.unix.programmer mailing list