curses bug

utzoo!decvax!ittvax!tpdcvax!bobvan utzoo!decvax!ittvax!tpdcvax!bobvan
Mon Sep 27 12:33:18 AEST 1982


I've tracked down a bug in curses on our 4.1BSD system, but I suspect
that it is present in all curseses.  It manifests itself as garbage
characters on your screen and is agrivated when using windows with
the left edge between column 0 and 7.  Here is a short C program that
shows the problem.  Note that if your terminal can't do CR without LF,
curses won't go for (and botch) the optimization.  It is known to fail
on VT-100's (sounds like a cigarette).

	#include	<curses.h>
	main()
	{
		WINDOW *w;

		initscr();
		w = newwin(3, 4, 4, 3);
		box(w, ':', '.');
		wrefresh();
		endwin();
	}

I have a fix, but make no claims about the quality.  With the fix
installed, the bug goes away.  However, it contains a goto and the code
around there is fairly crufty, so I don't want to make any guarantees.
Perhaps a Berkeley guru would like to suggest something cleaner?
A diff -c of the fix follows:

*** /usr/src/lib/libcurses/cr_put.c	Thu Mar  5 22:56:56 1981
--- cr_put.c	Thu Sep 23 13:47:52 1982
***************
*** 255,260
  			if (plodflg)	/* avoid a complex calculation */
  				plodcnt--;
  			else {
  				c = _win->_y[outline-_win->_begy][outcol-_win->_begx];
  				if ((c&_STANDOUT) == (curscr->_flags&_STANDOUT))
  					putchar(c);

--- 255,262 -----
  			if (plodflg)	/* avoid a complex calculation */
  				plodcnt--;
  			else {
+ 				if (outcol < _win->_begx) /* RAV hack fix */
+ 					goto nondes;
  				c = _win->_y[outline-_win->_begy][outcol-_win->_begx];
  				if ((c&_STANDOUT) == (curscr->_flags&_STANDOUT))
  					putchar(c);
------------------------------------

				Bob Van Valzah
				(...!decvax!ittvax!tpdcvax!bobvan)



More information about the Net.bugs mailing list