Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site sdcsvax.UUCP Path: utzoo!linus!decvax!ittvax!dcdwest!sdcsvax!laman From: laman@sdcsvax.UUCP Newsgroups: net.bugs.4bsd,net.bugs Subject: YACB (Yet Another (4.2 BSD) Curses Bug) Message-ID: <967@sdcsvax.UUCP> Date: Mon, 9-Jul-84 13:30:56 EDT Article-I.D.: sdcsvax.967 Posted: Mon Jul 9 13:30:56 1984 Date-Received: Tue, 10-Jul-84 07:46:03 EDT Organization: EECS Dept. U.C. San Diego Lines: 47 The bug that Mike Lilley found in overlay() is where the last line of the window being overlayed is not overlayed. The following program will tell you if you have the bug. The fix follows the program. It seems that the extraction of this library from "vi" has bitten us again. /* Beginning of program. Cut here------- */ #include main() { register WINDOW *win; initscr(); noecho(); win = newwin(0, 0, 0, 0); mvwaddstr(win, LINES/2, 12, "---Hit return to exit---"); mvwaddstr(win, LINES-2, 0, "The middle of the next line should say \"Hi\". If not you have the overlay bug."); mvwaddstr(win, LINES-1, COLS / 2 - 10, "Hi. You don't have the bug"); overlay(win, stdscr); refresh(); getchar(); move(LINES - 1, 0); refresh(); echo(); endwin(); } /* End of program. Cut here--------- */ If you have the bug, the following fixes takes care of the problem: On the first for loop in overlay() is: for (y = starty; y < endy; y++) { It should be: for (y = starty; y <= endy; y++) { The problem is that the computation of "endy" takes into account the fact that "_maxy" is "1 relative". The subtraction of 1 now makes it "0 relative", but the for-loop is treating it as "1 relative". Another solution is to remove the "- 1" from the assignment to "endy". Which ever you prefer. Mike Laman, NCR Torrey Pines UUCP: {ucbvax,philabs,sdccsu3,sdcsla}!sdcsvax!laman