1curs_refresh(3X) curs_refresh(3X)
2
3
4
6 doupdate, redrawwin, refresh, wnoutrefresh, wredrawln, wrefresh -
7 refresh curses windows and lines
8
10 #include <curses.h>
11
12 int refresh(void);
13 int wrefresh(WINDOW *win);
14 int wnoutrefresh(WINDOW *win);
15 int doupdate(void);
16 int redrawwin(WINDOW *win);
17 int wredrawln(WINDOW *win, int beg_line, int num_lines);
18
20 refresh/wrefresh
21 The refresh and wrefresh routines (or wnoutrefresh and doupdate) must
22 be called to get actual output to the terminal, as other routines mere‐
23 ly manipulate data structures. The routine wrefresh copies the named
24 window to the physical screen, taking into account what is already
25 there to do optimizations. The refresh routine is the same, using std‐
26 scr as the default window. Unless leaveok has been enabled, the physi‐
27 cal cursor of the terminal is left at the location of the cursor for
28 that window.
29
30 wnoutrefresh/doupdate
31 The wnoutrefresh and doupdate routines allow multiple updates with more
32 efficiency than wrefresh alone. In addition to all the window struc‐
33 tures, curses keeps two data structures representing the terminal
34 screen:
35
36 · a physical screen, describing what is actually on the screen, and
37
38 · a virtual screen, describing what the programmer wants to have on
39 the screen.
40
41 The routine wrefresh works by
42
43 · first calling wnoutrefresh, which copies the named window to the
44 virtual screen, and
45
46 · then calling doupdate, which compares the virtual screen to the
47 physical screen and does the actual update.
48
49 If the programmer wishes to output several windows at once, a series of
50 calls to wrefresh results in alternating calls to wnoutrefresh and
51 doupdate, causing several bursts of output to the screen. By first
52 calling wnoutrefresh for each window, it is then possible to call doup‐
53 date once, resulting in only one burst of output, with fewer total
54 characters transmitted and less CPU time used.
55
56 If the win argument to wrefresh is the physical screen (i.e., the glob‐
57 al variable curscr), the screen is immediately cleared and repainted
58 from scratch.
59
60 The phrase “copies the named window to the virtual screen” above is am‐
61 biguous. What actually happens is that all touched (changed) lines in
62 the window are copied to the virtual screen. This affects programs
63 that use overlapping windows; it means that if two windows overlap, you
64 can refresh them in either order and the overlap region will be modi‐
65 fied only when it is explicitly changed. (But see the section on
66 PORTABILITY below for a warning about exploiting this behavior.)
67
68 wredrawln/redrawwin
69 The wredrawln routine indicates to curses that some screen lines are
70 corrupted and should be thrown away before anything is written over
71 them. It touches the indicated lines (marking them changed). The rou‐
72 tine redrawwin touches the entire window.
73
75 Routines that return an integer return ERR upon failure, and OK (SVr4
76 only specifies "an integer value other than ERR") upon successful com‐
77 pletion.
78
79 X/Open does not define any error conditions. In this implementation
80
81 wnoutrefresh
82 returns an error if the window pointer is null, or if the win‐
83 dow is really a pad.
84
85 wredrawln
86 returns an error if the associated call to touchln returns an
87 error.
88
90 Note that refresh and redrawwin may be macros.
91
93 The XSI Curses standard, Issue 4 describes these functions.
94
95 Whether wnoutrefresh copies to the virtual screen the entire contents
96 of a window or just its changed portions has never been well-documented
97 in historic curses versions (including SVr4). It might be unwise to
98 rely on either behavior in programs that might have to be linked with
99 other curses implementations. Instead, you can do an explicit touchwin
100 before the wnoutrefresh call to guarantee an entire-contents copy any‐
101 where.
102
104 curses(3X), curs_outopts(3X) curs_variables(3X).
105
106
107
108 curs_refresh(3X)