HELP!! (CURSES problems)
Sharmin Dorostkar
sharmin at nbires.UUCP
Fri Jul 11 07:06:52 AEST 1986
Hello,
I am trying to use curses and its scrolling windows. Sometimes
the window I set up for scrolling will not scroll correctly. Specifically,
when I add a string to the bottom line of the screen followed by a CR,
the string will appear in the next-to-last line of the window on the
left hand side of the window. This problem does not always occur. It
only occurs once in a while.
Below is the setting described in detail. There are four windows
initilized as follows:
menuw = newwin(22,80,0,0);
scrollw = newwin(6,0,9,11);
netw = newwin(5,0,16,0);
promptw = nmewwin(0,0,22,0);
Note that scrollw and netw lie entirely on menuw.
In menuw, just above where scrollw begins, I have the following
column header:
COLUMN1 COLUMN2 COLUMN3 COLUMN4
------- -------- -------- --------
After this heading scrollw begins which is 6 lines long. In general,
the program and the user alternate adding strings to scrollw. The user fills
in COLUMN1 with some string in response to which the program fills in COLUMN2.
Then the user fills in COLUMN3 with some string in response to which the
program fills in COLUMN4 and then turns the cursor to the next line. When
the last line has been reached, the window is supposed to scroll up.
The program will move the cursor to the appropriate column each time it
is the user's turn to input a string. Also a prompt will appear in
promptw each time it is the user's turn to input a string.
Sometimes the program will fill in both COLUMN2 and COLUMN3,
then print a promt in the window "promptw" asking the user to press
one of two characters: an ESC or a CR. After this the prgram will fill
COLUMN4. It is in this situation where the scrolling problem occurs
sometimes.
All cursor movement is accomplished by printing blanks with waddch
or by calls to the routine wprintw. The cursor is moved to the next line by
a call to "waddch(scrollw,'\n');". All strings are input from the terminal by
calls to the routine "wgetch(scrollw)". A single character, as the above
mentioned ESC or CR, is input by a call to the routine "wgetch(promptw)".
The problem is that if the program is in the last line and
prints its string in COLUMN4 then issues a CR, instead of scrollin up straight,
this string will end up somewhere on the left hand side of the window between
COLUMN1 and COLUMN2. From here on CURSES does not know anymore what the
screen looks like and things will get worse and worse. This problem is
an intermittent problem. It does not occur every time.
I have made the following observations in trying to debug this:
- When I type a ^Z to stop the program, then fg to resume it, the window
is just how it should be. All the scrolling seems to have been
accomplished successfully.
- When I look at the window contents in struct WINDOW *scrollw, all seems
to be ok there also.
- The scrolling problem behaves different on different terminals. It
does not appear as badly on a WYSE-50 running with a tvi925 termcap.
It appears on a vt100 terminal and on an NBI2000 terminal running a
vt100 emulator.
If you have any idea where the problem could be, please get in
touch with me at
USENET: {hao, ucbvax, allegra}!nbires!sharmin
PHONE: (303) 444-5710
OR
Sharmin Dorostkar
c/o NBI
P.O. Box 9001
Boulder, CO 80301
Thanks for your time.
Sharmin
More information about the Comp.unix.wizards
mailing list