1curs_outopts(3X) curs_outopts(3X)
2
3
4
6 clearok, idlok, idcok, immedok, leaveok, setscrreg, wsetscrreg,
7 scrollok, nl, nonl - curses output options
8
10 #include <curses.h>
11
12 int clearok(WINDOW *win, bool bf);
13 int idlok(WINDOW *win, bool bf);
14 void idcok(WINDOW *win, bool bf);
15 void immedok(WINDOW *win, bool bf);
16 int leaveok(WINDOW *win, bool bf);
17 int setscrreg(int top, int bot);
18 int wsetscrreg(WINDOW *win, int top, int bot);
19 int scrollok(WINDOW *win, bool bf);
20 int nl(void);
21 int nonl(void);
22
24 These routines set options that change the style of output within curs‐
25 es. All options are initially FALSE, unless otherwise stated. It is
26 not necessary to turn these options off before calling endwin.
27
28 If clearok is called with TRUE as argument, the next call to wrefresh
29 with this window will clear the screen completely and redraw the entire
30 screen from scratch. This is useful when the contents of the screen
31 are uncertain, or in some cases for a more pleasing visual effect. If
32 the win argument to clearok is the global variable curscr, the next
33 call to wrefresh with any window causes the screen to be cleared and
34 repainted from scratch.
35
36 If idlok is called with TRUE as second argument, curses considers using
37 the hardware insert/delete line feature of terminals so equipped.
38 Calling idlok with FALSE as second argument disables use of line inser‐
39 tion and deletion. This option should be enabled only if the applica‐
40 tion needs insert/delete line, for example, for a screen editor. It is
41 disabled by default because insert/delete line tends to be visually an‐
42 noying when used in applications where it is not really needed. If in‐
43 sert/delete line cannot be used, curses redraws the changed portions of
44 all lines.
45
46 If idcok is called with FALSE as second argument, curses no longer con‐
47 siders using the hardware insert/delete character feature of terminals
48 so equipped. Use of character insert/delete is enabled by default.
49 Calling idcok with TRUE as second argument re-enables use of character
50 insertion and deletion.
51
52 If immedok is called with TRUE as argument, any change in the window
53 image, such as the ones caused by waddch, wclrtobot, wscrl, etc., auto‐
54 matically cause a call to wrefresh. However, it may degrade perfor‐
55 mance considerably, due to repeated calls to wrefresh. It is disabled
56 by default.
57
58 Normally, the hardware cursor is left at the location of the window
59 cursor being refreshed. The leaveok option allows the cursor to be
60 left wherever the update happens to leave it. It is useful for appli‐
61 cations where the cursor is not used, since it reduces the need for
62 cursor motions.
63
64 The setscrreg and wsetscrreg routines allow the application programmer
65 to set a software scrolling region in a window. top and bot are the
66 line numbers of the top and bottom margin of the scrolling region.
67 (Line 0 is the top line of the window.) If this option and scrollok
68 are enabled, an attempt to move off the bottom margin line causes all
69 lines in the scrolling region to scroll one line in the direction of
70 the first line. Only the text of the window is scrolled. (Note that
71 this has nothing to do with the use of a physical scrolling region ca‐
72 pability in the terminal, like that in the VT100. If idlok is enabled
73 and the terminal has either a scrolling region or insert/delete line
74 capability, they will probably be used by the output routines.)
75
76 The scrollok option controls what happens when the cursor of a window
77 is moved off the edge of the window or scrolling region, either as a
78 result of a newline action on the bottom line, or typing the last char‐
79 acter of the last line. If disabled, (bf is FALSE), the cursor is left
80 on the bottom line. If enabled, (bf is TRUE), the window is scrolled
81 up one line (Note that to get the physical scrolling effect on the ter‐
82 minal, it is also necessary to call idlok).
83
84 The nl and nonl routines control whether the underlying display device
85 translates the return key into newline on input, and whether it trans‐
86 lates newline into return and line-feed on output (in either case, the
87 call addch('\n') does the equivalent of return and line feed on the
88 virtual screen). Initially, these translations do occur. If you dis‐
89 able them using nonl, curses will be able to make better use of the
90 line-feed capability, resulting in faster cursor motion. Also, curses
91 will then be able to detect the return key.
92
94 The functions setscrreg and wsetscrreg return OK upon success and ERR
95 upon failure. All other routines that return an integer always return
96 OK.
97
98 X/Open does not define any error conditions.
99
100 In this implementation, those functions that have a window pointer will
101 return an error if the window pointer is null.
102
103 wclrtoeol
104 returns an error if the cursor position is about to wrap.
105
106 wsetscrreg
107 returns an error if the scrolling region limits extend out‐
108 side the window.
109
110 X/Open does not define any error conditions. This implementation re‐
111 turns an error if the window pointer is null.
112
114 These functions are described in the XSI Curses standard, Issue 4.
115
116 The XSI Curses standard is ambiguous on the question of whether raw()
117 should disable the CRLF translations controlled by nl() and nonl().
118 BSD curses did turn off these translations; AT&T curses (at least as
119 late as SVr1) did not. We choose to do so, on the theory that a pro‐
120 grammer requesting raw input wants a clean (ideally 8-bit clean) con‐
121 nection that the operating system will not alter.
122
123 Some historic curses implementations had, as an undocumented feature,
124 the ability to do the equivalent of clearok(..., 1) by saying touch‐
125 win(stdscr) or clear(stdscr). This will not work under ncurses.
126
127 Earlier System V curses implementations specified that with scrollok
128 enabled, any window modification triggering a scroll also forced a
129 physical refresh. XSI Curses does not require this, and ncurses avoids
130 doing it to perform better vertical-motion optimization at wrefresh
131 time.
132
133 The XSI Curses standard does not mention that the cursor should be made
134 invisible as a side-effect of leaveok. SVr4 curses documentation does
135 this, but the code does not. Use curs_set to make the cursor invisi‐
136 ble.
137
139 Note that clearok, leaveok, scrollok, idcok, nl, nonl and setscrreg may
140 be macros.
141
142 The immedok routine is useful for windows that are used as terminal em‐
143 ulators.
144
146 curses(3X), curs_addch(3X), curs_clear(3X), curs_initscr(3X),
147 curs_scroll(3X), curs_refresh(3X)
148
149
150
151 curs_outopts(3X)