Help! Problems with curses!
goldberg at uiucdcs.UUCP
goldberg at uiucdcs.UUCP
Tue Nov 6 07:51:00 AEST 1984
I believe that these fixes have been installed here at UIUC. You might
try them. They are courtesy of Mike Laman.
Phil Goldberg
goldberg at Uiuc
goldberg.Uiuc at csnet
...!{ihnp4,convex,pur-ee}!uiucdcs!goldberg
/* Written 11:44 am Nov 18, 1983 by laman at sdcsvax in uiucdcsc:net.bugs */
/* ---------- "Curses bug fixes (4.2 and net.source" ---------- */
Luckily I saved copies of my two bug fixes. Here are the two fixes that I sent
out earlier, but which probably didn't make it far out of San Diego. I have
since used the second bug fix (the one to wrefresh()) enough to say that
it speeds up some of the output up on non CPU bound programs. The speed up
was noticeable in some of my programs!
First bug report:
There is a bug in wdeleteln(). This bug is in the curses library distributed
over net.sources, and in the 4.2 BSD distribution (that sdcsvax received
at least).
Even though the last line of the window gets cleared internally, its "refresh"
image may not. The fix is simple. Add the following two lines to the end
of the wdeleteln() routine.
win->_firstch[win->_maxy-1] = 0;
win->_lastch[win->_maxy-1] = win->_maxx - 1;
Now wrefresh() will look at the entire line.
I have enclosed a little program that will show you if you have the bug. Just
compile it with you curses library (termlib too) and run it.
#include <curses.h>
main() {
register i;
initscr();
mvaddstr(0, 20, "This program will delete line #5 after");
mvaddstr(1, 20, "writing the line number for each line.");
for(i = 0; i < LINES; ++i)
mvprintw(i, 0, "Line #%d", i);
refresh();
addstr(" You have the bug if the BOTTOM line is not COMPLETELY blank!");
move(5, 0);
deleteln();
move(LINES - 3, 0);
refresh();
endwin();
}
Second Bug Report:
The following bug is in the curses library distributed over net.sources,
and in the 4.2 BSD distribution (that sdcsvax received at least).
The bug is in makech() (in refresh.c). makech() gets called to give
output for the given LINE (hint hint). It is interesting that this bug
managed to get out. Here is the offending code (the simple fix follows).
:
:
:
else if (wx < lch)
while (*nsp == *csp) {
nsp++;
if (!curwin)
csp++;
++wx;
}
else
:
:
:
I wrote a program that added '*' to (0, 0) on stdscr then a refresh().
wx ended up with a value of over 3000! That loop walked down the line
and the next, ... (all the way down the window!). The following code
is the fix. Notice that the ++wx looks just perfect. It really makes one
think "they" thought of it, but merely forgot to add the test.
:
:
:
else if (wx < lch)
while (*nsp == *csp && wx <= lch) {
nsp++;
if (!curwin)
csp++;
++wx;
}
else
:
:
:
I apologize to those of you seeing some of this for a THIRD time, but I want
these to get into the distribution.
Mike Laman
UUCP: {ucbvax,philabs,sdccsu3,sdcsla}!sdcsvax!laman
/* End of text from uiucdcsc:net.bugs */
More information about the Comp.unix.wizards
mailing list