summaryrefslogtreecommitdiffstats
path: root/lib/libncurses/curs_refresh.3
blob: 3c204e2ae5db945e3c9732ee9b3b8d6becad5050 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
.TH curs_refresh 3 ""
.SH NAME
\fBrefresh\fR, \fBwrefresh\fR, \fBwnoutrefresh\fR,
\fBdoupdate\fR, \fBredrawwin\fR, 
\fBwredrawln\fR - refresh \fBncurses\fR windows and lines
.SH SYNOPSIS
\fB#include <ncurses.h>\fR

\fBint refresh(void);\fR
.br
\fBint wrefresh(WINDOW *win);\fR
.br
\fBint wnoutrefresh(WINDOW *win);\fR
.br
\fBint doupdate(void);\fR
.br
\fBint redrawwin(WINDOW *win);\fR
.br
\fBint wredrawln(WINDOW *win, int beg_line, int num_lines);\fR
.br
.SH DESCRIPTION
The \fBrefresh\fR and \fBwrefresh\fR routines (or \fBwnoutrefresh\fR and
\fBdoupdate\fR) must be called to get actual output to the terminal, as other
routines merely manipulate data structures.  The routine \fBwrefresh\fR copies
the named window to the physical terminal screen, taking into account what is
already there in order to do optimizations.  The \fBrefresh\fR routine is the
same, using \fBstdscr\fR as the default window.  Unless \fBleaveok\fR has been
enabled, the physical cursor of the terminal is left at the location of the
cursor for that window.

The \fBwnoutrefresh\fR and \fBdoupdate\fR routines allow multiple updates with
more efficiency than \fBwrefresh\fR alone.  In addition to all the window
structures, \fBncurses\fR keeps two data structures representing the terminal
screen: a physical screen, describing what is actually on the screen, and a
virtual screen, describing what the programmer wants to have on the screen.

The routine \fBwrefresh\fR works by first calling \fBwnoutrefresh\fR, which
copies the named window to the virtual screen, and then calling \fBdoupdate\fR,
which compares the virtual screen to the physical screen and does the actual
update.  If the programmer wishes to output several windows at once, a series
of calls to \fBwrefresh\fR results in alternating calls to \fBwnoutrefresh\fR
and \fBdoupdate\fR, causing several bursts of output to the screen.  By first
calling \fBwnoutrefresh\fR for each window, it is then possible to call
\fBdoupdate\fR once, resulting in only one burst of output, with fewer total
characters transmitted and less CPU time used.  If the \fIwin\fR argument to
\fBwrefresh\fR is the global variable \fBcurscr\fR, the screen is immediately
cleared and repainted from scratch.

The \fBredrawwin\fR routine indicates to \fBncurses\fR that some screen lines
are corrupted and should be thrown away before anything is written over them.
These routines could be used for programs such as editors, which want a command
to redraw some part of the screen or the entire screen.  The routine
\fBredrawln\fR is preferred over \fBredrawwin\fR where a noisy communication
line exists and redrawing the entire window could be subject to even more
communication noise.  Just redrawing several lines offers the possibility that
they would show up unblemished.
.SH RETURN VALUE
All routines return the integer \fBERR\fR upon failure and an integer value
other than \fBERR\fR upon successful completion.
.SH NOTES
Note that \fBrefresh\fR and \fBredrawwin\fR may be macros.
.SH SEE ALSO
\fBncurses\fR(3), \fBcurs_outopts\fR(3)
.\"#
.\"# The following sets edit modes for GNU EMACS
.\"# Local Variables:
.\"# mode:nroff
.\"# fill-column:79
.\"# End:
OpenPOWER on IntegriCloud