[comp.unix.wizards] curses and terminfo

phr@anuck.UUCP (12/04/87)

I need help from people who have used Curses and are familiar with
terminfo.  Recently I have been using curses and have noted some
strange behavior.  I am not sure if the problems represent "features"
of curses or are indicating that I am using curses incorrectly.  Any
help on the following is appreciated.

1.  I have noticed that cursors can not create a box around a window
    which is the size of the entire screen.  The last row, last column
    position remains "unboxed".

2.  The screen cursor often flickers across the screen as I enter
    text when using getstr or getch.  This flickering seems to be
    worse if I have used reverse video for displaying any text or boxes
    on the screen.

3.  If I define a boxed window, with a reverse video border, which starts
    in column 2 of the screen, the border appears in column 1 and 2, except
    for the very first row and column which does not contain the border.

Has anyone else experienced this strange behavior with Curses?  Is it a
problem with the tool or with the application using curses?  

Thanks for any suggestions.

L. Hilliard
8-245-4595
MV 3E-11
anuck!phr  or mvuxn!lah

 

allbery@ncoast.UUCP (Brandon Allbery) (12/08/87)

As quoted from <409@anuck.UUCP> by phr@anuck.UUCP (p.h.reed):
+---------------
| 1.  I have noticed that cursors can not create a box around a window
|     which is the size of the entire screen.  The last row, last column
|     position remains "unboxed".
+---------------

Curses won't write that last column, since most terminals will scroll the
first line off the screen if it does.  See also #3.

+---------------
| 2.  The screen cursor often flickers across the screen as I enter
|     text when using getstr or getch.  This flickering seems to be
|     worse if I have used reverse video for displaying any text or boxes
|     on the screen.
+---------------

Especially when screen attributes are used, refresh() does some fancy
repainting when only a single character is being updated.  V.3 terminfo
has a call "echochar()" which avoids this in many cases.

+---------------
| 3.  If I define a boxed window, with a reverse video border, which starts
|     in column 2 of the screen, the border appears in column 1 and 2, except
|     for the very first row and column which does not contain the border.
+---------------

Sounds like it might be a problem with your terminfo description.  Check the
description; if displaying a character in the last column of the screen makes
the cursor move to the next line, you should add the "am" boolean to the
description and re-"tic" it.

I have a bug to report in V.3 terminfo; maybe someone else already knows
about it, but....

The bug is that wsetscrreg() doesn't check to insure that its arguments are
in range.  If they aren't, curses won't scroll; moreover, the cursor will move
outside the window when attempting to scroll.  (It doesn't display anything,
but the window's cursor ends up *outside* the window.)

The fix:  since wsetscrreg() is a macro, anyone (including binary sites) can
change it.  The values to be set should be tested against 0 and (w)->_maxy,
and also checked so that the second value is >= the first.
-- 
Brandon S. Allbery		      necntc!ncoast!allbery@harvard.harvard.edu
 {hoptoad,harvard!necntc,cbosgd,sun!mandrill!hal,uunet!hnsurg3}!ncoast!allbery
			Moderator of comp.sources.misc