AT&T 3B2, PC-NFS, Curses - reverse video with werase()
dxg at cai.com
dxg at cai.com
Thu Aug 16 00:12:17 AEST 1990
/**********************************************************************
*
* I am using PC-NFS Version 3.0 to connect to an AT&T 3B2 running UNIX
* System V Release 3.2.1. My environment variable TERM is 'vt100'.
*
* I am developing a large application using Curses and have run into
* a problem. I have to output a string to a window, in reverse video
* and then clear this window. But for some reason when the window
* is cleared the row that contains the reverse video character(s)
* and all the rows that follow are cleared (output) in reverse video.
*
* This problem occurs when the last character output is in reverse video.
*
* The problem does not occur, if the last non-blank character output is
* not in reverse video.
*
* The following source file is a small scale version of the problem.
*
* The compile command that I am using is:
* cc $*.c -o $* -lm -lcurses
*
* Please let me know how I can work around this problem, or what I
* am doing wrong.
*
* Thanks,
* Constantine "Dean" Grammas
* Computer Associates International
* 201 University Avenue
* Westwood MA, 02090
* (617) 329-7700 x3314
*
*/
/*********************
**** TEST ROUTINE ****
**********************/
#include <curses.h>
/*
* Repaint the the specified window
*/
rep_win( wid )
WINDOW *wid;
{
/* just for arguments sake, turn off the reverse video attribute
*/
wattroff( wid, A_REVERSE );
wnoutrefresh( wid );
touchwin( wid );
doupdate();
} /* END rep_win */
/*
* Repaint the specified window and wait for a key stroke
*/
get_key( wid )
WINDOW *wid;
{
/* just for arguments sake, turn off the reverse video attribute
*/
wattroff( wid, A_REVERSE );
rep_win( wid );
beep();
wgetch( wid );
} /* END get_key */
/*
* Clear the specified window and then repaint it
*/
clr_win( wid )
WINDOW *wid;
{
/* just for arguments sake, turn off the reverse video attribute
*/
wattroff( wid, A_REVERSE );
werase( wid );
rep_win( wid );
} /* END clr_win */
main()
{
WINDOW *wid;
stdscr = initscr();
/* output a line of text in reverse video, and wait for a key stroke
*/
wattrset( stdscr, A_REVERSE );
mvwaddstr( stdscr, 10,10, "Press any key." );
wattroff( stdscr, A_REVERSE );
wattrset( stdscr, A_NORMAL );
get_key( stdscr );
/* clear the window, and wait for a keystroke
*
* NOTE: this is where the problem occurs.
*/
wattrset( stdscr, A_NORMAL );
clr_win( stdscr );
get_key( stdscr );
endwin();
} /* END main */
More information about the Comp.unix.wizards
mailing list