john@mplvax.UUCP (11/21/83)
Will someone post or send me the fixes for the curses bugs in 4.1 BSD? Thanks, John McInerney
laman@sdcsvax.UUCP (11/21/83)
Some one asked for bug fixes to 4.1 curses. All the following should be relevant. I am posting this synopsis to answer his request and since San Diego was cut off for about a month, others may find it interesting (otherwise I would have just replied to him). I apologize to those in the San Diego area who has seen parts of this for the fourth time. Strange though, the request is from the San Diego area.... (In case some of you are sick of hearing from me, I'm just as tired reposting these, but I'd want the help if I asked for it too. The comedy of error (network, ...) didn't help. Ahhh. I feel better.) I have included two messages that I sent out on bug fixes. They are at the end. Several other fixes are as follows: 1. Add touchwin(win); to the end of winsertln(). 2. If your loop in wgetstr() has a semicolon on the end which blocks off the pointer incrementation as implied by the indentation style, remove that semi colon: while(some ugly god awful expression); ++str; ^ | | Dumb huh 3. If your first loop in wdeleteln() looks like: : : : for (y = win->_cury; y < win->_maxy - 2; y++) { : : : This doesn't get the last line of the given window. Change it to the following: : : : for (y = win->_cury; y < win->_maxy - 1; y++) { : : : Here are the other two fixes which I have previously posted on the network. 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(); } And the other: 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 : : : Mike Laman UUCP: {ucbvax,philabs,sdccsu3,sdcsla}!sdcsvax!laman