Bug 13978

Summary: a write to last column bug appears since ncurses conversion
Product: Base System Reporter: hm <hm>
Component: kernAssignee: Rong-En Fan <rafan>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.0-CURRENT   
Hardware: Any   
OS: Any   

Description hm 1999-09-26 19:10:01 UTC
	In contrast to FreeBSD 3.2-Stable, it is no longer possible in a 
	curses window (with scrollok enabled - if that matters) to write
	to the last column without causing a newline to occur.

	Running the program below compiled on 3.2 displaying in an xterm
	on a 4.0 machine gives one output line beneath the other without
	blank lines between output lines.

	Running the same program compiled on 4.0 displaying in the same
	xterm on a 4.0 machine gives a blank line after each line of output
	from the program.

Fix: 

None.
How-To-Repeat: 
	Compile the program on a 3.2-stable system and on a 4.0 current
	system (later or equal to September 25, 1999) with:

		cc test.c -lcurses

	and run each compilation result in a standard xterm (my termcap
	entry used was "xterms|vs100s" on 4.0 current) as described above
	in the Description section.

	The effect is also visible on the console using the pcvt
	driver in 3.2 and 4.0.


#include <curses.h>

#define MAXJ 10

main()
{
	WINDOW *windowp;
	int i, j;
	
	initscr();
	noecho();
	raw();

	if((windowp = newwin(10, COLS, 5, 0)) == NULL)
	{
		endwin();
		fprintf(stderr, "ERROR, curses init window\n");
		exit(1);
	}
	
	scrollok(windowp, 1);

	wmove(windowp, 0, 0);

	for(j=0; j < MAXJ; j++)
	{
		char buf[] = "BUFFER";
		char what[] = "WHAT";
		char msg[] = ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
		
                wprintw(windowp, "%d %s %s %-.*s\n", j, buf, what,
       	             COLS-((strlen(buf))+(strlen(what))+4), msg);
		wrefresh(windowp);
		sleep(1);
	}

	endwin();
}
Comment 1 Sheldon Hearn freebsd_committer freebsd_triage 1999-09-27 08:30:12 UTC
Responsible Changed
From-To: freebsd-bugs->peter

The new ncurses is Peter's baby. 
Comment 2 Rong-En Fan freebsd_committer freebsd_triage 2007-04-28 16:08:09 UTC
State Changed
From-To: open->closed

According to ncurses author, the extra line is expected 
behavior and Solaris/Tru64's curses lib does the same thing. 
Submitter agrees to close this PR since it's something 
related to ncurses itself and should be addressed there. 


Comment 3 Rong-En Fan freebsd_committer freebsd_triage 2007-04-28 16:08:09 UTC
Responsible Changed
From-To: peter->rafan

ncurses is now my baby.