Add redrawwin() and wredrawln().

Fixes PR lib/20038.
This commit is contained in:
jdc 2003-10-05 10:13:02 +00:00
parent b469b163b9
commit d4f82864b6
5 changed files with 91 additions and 20 deletions

View File

@ -233,7 +233,7 @@ the corners are left blank to avoid a scroll.
.De
Check if terminal can change colors.
.Ds
.Fn cbreak "" \(dg
.Fn cbreak ""
.De
Set the terminal to cbreak mode.
.Ds
@ -1128,7 +1128,7 @@ Thus, to get a new window of dimensions
use
.Fn newwin 0 0 0 0 .
.Ds
.Fn nl "" \(dg
.Fn nl ""
.De
Set the terminal to nl mode,
.i i.e. ,
@ -1145,7 +1145,7 @@ so it is recommended, but not required, to turn it off.
.De
Return attributes that cannot be combined with color.
.Ds
.Fn nocbreak "" \(dg
.Fn nocbreak ""
.De
Unset the terminal from cbreak mode.
.Ds
@ -1176,19 +1176,19 @@ to block indefinitely. See also
.De
Turn echoing of characters off.
.Ds
.Fn nonl "" \(dg
.Fn nonl ""
.De
Unset the terminal to from nl mode. See
.Fn nl .
.ne 1i
.Ds
.Fn noqiflush
.Fn noqiflush \(dg
.De
Unset the terminal flush on interrupt mode.
This is equivalent to
.Fn intrflush stdscr FALSE .
.Ds
.Fn noraw "" \(dg
.Fn noraw ""
.De
Unset the terminal from raw mode. See
.Fn raw .
@ -1280,13 +1280,13 @@ It is often advisable to use the field width options of
to avoid leaving things on the window from earlier calls.
\*(Es
.Ds
.Fn qiflush
.Fn qiflush \(dg
.De
Set the terminal flush on interrupt mode.
This is equivalent to
.Fn intrflush stdscr TRUE .
.Ds
.Fn raw "" \(dg
.Fn raw ""
.De
Set the terminal to raw mode.
On version 7
@ -1300,6 +1300,13 @@ this also turns off newline mapping
(see
.Fn nl ).
.Ds
.Fn redrawwin "WINDOW *win" \(dg
.De
Mark the entire window as having been corrupted.
This is equivalent to the
.Fn touchwin
function.
.Ds
.Fn refresh "" \(dg
.De
Synchronize the terminal screen with the desired window.
@ -1628,6 +1635,16 @@ before a call to
.Fn doupdate ,
thus allowing the screen to updated in an efficient manner.
.Ds
.Fn wredrawln "WINDOW *win" "int line" "int n" \(dg
.De
Mark
.Vn n
lines starting at
.Vn line
in the window as corrupted.
This is equivalent to
.Fn wtouchln "win" "line" "n" "1" .
.Ds
.Fn wresize "WINDOW *win" "int lines" "int columns"
.De
Resize the specified window to the given dimensions. The window will be

View File

@ -1,4 +1,4 @@
.\" $NetBSD: curses.3,v 1.51 2003/08/07 16:44:20 agc Exp $
.\" $NetBSD: curses.3,v 1.52 2003/10/05 10:13:02 jdc Exp $
.\"
.\" Copyright (c) 1985, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\"
.\" @(#)curses.3 8.1 (Berkeley) 6/4/93
.\"
.Dd May 21, 2003
.Dd September 23, 2003
.Dt CURSES 3
.Os
.Sh NAME
@ -212,6 +212,7 @@ must be called before any of the other routines that deal with color are used.
.It printw Ta Xr curses_print 3
.It qiflush Ta Xr curses_tty 3
.It raw Ta Xr curses_tty 3
.It redrawwin Ta Xr curses_touch 3
.It refresh Ta Xr curses_refresh 3
.It reset_prog_mode Ta Xr curses_tty 3
.It reset_shell_mode Ta Xr curses_tty 3
@ -278,6 +279,7 @@ must be called before any of the other routines that deal with color are used.
.It wmove Ta Xr curses_cursor 3
.It wnoutrefresh Ta Xr curses_refresh 3
.It wprintw Ta Xr curses_print 3
.It wredrawln Ta Xr curses_touch 3
.It wrefresh Ta Xr curses_refresh 3
.It wresize Ta Xr curses_window 3
.It wscanw Ta Xr curses_scanw 3

View File

@ -1,4 +1,4 @@
/* $NetBSD: curses.h,v 1.78 2003/08/07 16:44:20 agc Exp $ */
/* $NetBSD: curses.h,v 1.79 2003/10/05 10:13:02 jdc Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -611,6 +611,7 @@ int printw(const char *, ...)
__attribute__((__format__(__printf__, 1, 2)));
void qiflush(void);
int raw(void);
int redrawwin(WINDOW *);
int reset_prog_mode(void);
int reset_shell_mode(void);
int resetty(void);
@ -674,6 +675,7 @@ int wmove(WINDOW *, int, int);
int wnoutrefresh(WINDOW *);
int wprintw(WINDOW *, const char *, ...)
__attribute__((__format__(__printf__, 2, 3)));
int wredrawln(WINDOW *, int, int);
int wrefresh(WINDOW *);
int wresize(WINDOW *, int, int);
int wscanw(WINDOW *, const char *, ...)

View File

@ -1,4 +1,4 @@
.\" $NetBSD: curses_touch.3,v 1.3 2003/04/16 13:35:01 wiz Exp $
.\" $NetBSD: curses_touch.3,v 1.4 2003/10/05 10:13:02 jdc Exp $
.\"
.\" Copyright (c) 2002
.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au)
@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\"
.Dd August 12, 2002
.Dd September 23, 2003
.Dt CURSES_TOUCH 3
.Os
.Sh NAME
@ -41,7 +41,9 @@
.Nm untouchwin ,
.Nm wtouchln ,
.Nm is_linetouched ,
.Nm is_wintouched
.Nm is_wintouched ,
.Nm redrawwin ,
.Nm wredrawln
.Nd curses window modification routines
.Sh LIBRARY
.Lb libcurses
@ -61,6 +63,10 @@
.Fn is_linetouched "WINDOW *win" "int line"
.Ft bool
.Fn is_wintouched "WINDOW *win"
.Ft int
.Fn redrawwin "WINDOW *win"
.Ft int
.Fn wredrawln "WINDOW *win" "int line" "int n"
.Sh DESCRIPTION
These functions mark lines and windows as modified and check the modification
status of lines and windows.
@ -134,6 +140,25 @@ if the window
has been modified since the last refresh, otherwise
.Dv FALSE
is returned.
.Pp
The
.Fn redrawwin
function marks the entire window
.Fa win
as having been corrupted.
Is is equivalent to the
.Fn touchwin
function.
.Pp
The
.Fn wredrawln
function marks
.Fa n
lines starting at
.Fa line
in the given window as corrupted.
It is equivalent to
.Fn wtouchln win line n 1 .
.Sh RETURN VALUES
Functions returning pointers will return
.Dv NULL

View File

@ -1,4 +1,4 @@
/* $NetBSD: touchwin.c,v 1.19 2003/08/07 16:44:24 agc Exp $ */
/* $NetBSD: touchwin.c,v 1.20 2003/10/05 10:13:03 jdc Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)touchwin.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: touchwin.c,v 1.19 2003/08/07 16:44:24 agc Exp $");
__RCSID("$NetBSD: touchwin.c,v 1.20 2003/10/05 10:13:03 jdc Exp $");
#endif
#endif /* not lint */
@ -54,18 +54,30 @@ is_linetouched(WINDOW *win, int line)
return ((win->lines[line]->flags & __ISDIRTY) != 0);
}
/*
* Touch count lines starting at start. This is the SUS v2 compliant
* version.
* touchline --
* Touch count lines starting at start. This is the SUS v2 compliant
* version.
*/
int
touchline(WINDOW *win, int start, int count)
{
return wtouchln(win, start, count, 1);
}
/*
* wredrawln --
* Mark count lines starting at start as corrupted. Implemented using
* wtouchln().
*/
int wredrawln(WINDOW *win, int start, int count)
{
#ifdef DEBUG
__CTRACE("wredrawln: (%p, %d, %d)\n", win, start, count);
#endif
return wtouchln(win, start, count, 1);
}
/*
* is_wintouched --
* Check if the window has been touched.
@ -97,6 +109,19 @@ touchwin(WINDOW *win)
return wtouchln(win, 0, win->maxy, 1);
}
/*
* redrawwin --
* Mark entire window as corrupted. Implemented using wtouchln().
*/
int
redrawwin(WINDOW *win)
{
#ifdef DEBUG
__CTRACE("redrawwin: (%p)\n", win);
#endif
return wtouchln(win, 0, win->maxy, 1);
}
/*
* untouchwin --
* Make it look like the window has not been changed.