Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | .\"*************************************************************************** |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 2 | .\" Copyright 2018-2023,2024 Thomas E. Dickey * |
| 3 | .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. * |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 4 | .\" * |
| 5 | .\" Permission is hereby granted, free of charge, to any person obtaining a * |
| 6 | .\" copy of this software and associated documentation files (the * |
| 7 | .\" "Software"), to deal in the Software without restriction, including * |
| 8 | .\" without limitation the rights to use, copy, modify, merge, publish, * |
| 9 | .\" distribute, distribute with modifications, sublicense, and/or sell * |
| 10 | .\" copies of the Software, and to permit persons to whom the Software is * |
| 11 | .\" furnished to do so, subject to the following conditions: * |
| 12 | .\" * |
| 13 | .\" The above copyright notice and this permission notice shall be included * |
| 14 | .\" in all copies or substantial portions of the Software. * |
| 15 | .\" * |
| 16 | .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
| 17 | .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
| 18 | .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
| 19 | .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
| 20 | .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
| 21 | .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
| 22 | .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
| 23 | .\" * |
| 24 | .\" Except as contained in this notice, the name(s) of the above copyright * |
| 25 | .\" holders shall not be used in advertising or otherwise to promote the * |
| 26 | .\" sale, use or other dealings in this Software without prior written * |
| 27 | .\" authorization. * |
| 28 | .\"*************************************************************************** |
| 29 | .\" |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 30 | .\" $Id: curs_outopts.3x,v 1.64 2024/04/20 21:24:19 tom Exp $ |
| 31 | .TH curs_outopts 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" |
| 32 | .de bP |
| 33 | .ie n .IP \(bu 4 |
| 34 | .el .IP \(bu 2 |
| 35 | .. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 36 | .SH NAME |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 37 | \fB\%clearok\fP, |
| 38 | \fB\%idlok\fP, |
| 39 | \fB\%idcok\fP, |
| 40 | \fB\%immedok\fP, |
| 41 | \fB\%leaveok\fP, |
| 42 | \fB\%setscrreg\fP, |
| 43 | \fB\%wsetscrreg\fP, |
| 44 | \fB\%scrollok\fP \- |
| 45 | set \fIcurses\fR output options |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 46 | .SH SYNOPSIS |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 47 | .nf |
| 48 | \fB#include <curses.h> |
| 49 | .PP |
| 50 | \fBint clearok(WINDOW *\fIwin\fP, bool \fIbf\fP); |
| 51 | \fBint idlok(WINDOW *\fIwin\fP, bool \fIbf\fP); |
| 52 | \fBvoid idcok(WINDOW *\fIwin\fP, bool \fIbf\fP); |
| 53 | \fBvoid immedok(WINDOW *\fIwin\fP, bool \fIbf\fP); |
| 54 | \fBint leaveok(WINDOW *\fIwin\fP, bool \fIbf\fP); |
| 55 | \fBint scrollok(WINDOW *\fIwin\fP, bool \fIbf\fP); |
| 56 | .PP |
| 57 | \fBint setscrreg(int \fItop\fP, int \fIbot\fP); |
| 58 | \fBint wsetscrreg(WINDOW *\fIwin\fP, int \fItop\fP, int \fIbot\fP); |
| 59 | .fi |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 60 | .SH DESCRIPTION |
| 61 | These routines set options that change the style of output within |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 62 | \fBcurses\fP. |
| 63 | All options are initially \fBFALSE\fP, unless otherwise stated. |
| 64 | It is not necessary to turn these options off before calling \fBendwin\fP(3X). |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 65 | .SS clearok |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 66 | If \fBclearok\fP is called with \fBTRUE\fP as argument, the next |
| 67 | call to \fBwrefresh\fP with this window will clear the screen completely and |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 68 | redraw the entire screen from scratch. |
| 69 | This is useful when the contents of the |
| 70 | screen are uncertain, or in some cases for a more pleasing visual effect. |
| 71 | If |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 72 | the \fIwin\fP argument to \fBclearok\fP is the global variable \fBcurscr\fP, |
| 73 | the next call to \fBwrefresh\fP with any window causes the screen to be cleared |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 74 | and repainted from scratch. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 75 | .SS idlok |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 76 | If \fBidlok\fP is called with \fBTRUE\fP as second argument, \fBcurses\fP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 77 | considers using the hardware insert/delete line feature of terminals so |
| 78 | equipped. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 79 | Calling \fBidlok\fP with \fBFALSE\fP as second argument disables use |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 80 | of line insertion and deletion. |
| 81 | This option should be enabled only if the |
| 82 | application needs insert/delete line, for example, for a screen editor. |
| 83 | It is |
| 84 | disabled by default because insert/delete line tends to be visually annoying |
| 85 | when used in applications where it is not really needed. |
| 86 | If insert/delete line |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 87 | cannot be used, \fBcurses\fP redraws the changed portions of all lines. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 88 | .SS idcok |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 89 | If \fBidcok\fP is called with \fBFALSE\fP as second argument, \fBcurses\fP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 90 | no longer considers using the hardware insert/delete character feature of |
| 91 | terminals so equipped. |
| 92 | Use of character insert/delete is enabled by default. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 93 | Calling \fBidcok\fP with \fBTRUE\fP as second argument re-enables use |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 94 | of character insertion and deletion. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 95 | .SS immedok |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 96 | If \fBimmedok\fP is called with \fBTRUE\fP as second argument, |
| 97 | any change in the window image, |
| 98 | such as the ones caused by \fBwaddch, wclrtobot, wscrl\fP, |
| 99 | etc., automatically causes a call to \fBwrefresh\fP. |
| 100 | However, it may degrade performance considerably, |
| 101 | due to repeated calls to \fBwrefresh\fP. |
| 102 | Calling \fBimmedok\fP with \fBFALSE\fP as second argument |
| 103 | restores the default behavior, |
| 104 | i.e., deferring screen updates until a refresh is needed. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 105 | .SS leaveok |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 106 | Normally, the hardware cursor is left at the location of the window cursor |
| 107 | being refreshed. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 108 | The \fBleaveok\fP option allows the cursor to be left |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 109 | wherever the update happens to leave it. |
| 110 | It is useful for applications where |
| 111 | the cursor is not used, since it reduces the need for cursor motions. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 112 | .SS scrollok |
| 113 | The \fBscrollok\fP option controls what happens when the cursor of a window is |
| 114 | moved off the edge of the window or scrolling region, either as a result of a |
| 115 | newline action on the bottom line, or typing the last character of the last |
| 116 | line. |
| 117 | If disabled, (\fIbf\fP is \fBFALSE\fP), the cursor is left on the bottom |
| 118 | line. |
| 119 | If enabled, (\fIbf\fP is \fBTRUE\fP), the window is scrolled up one line |
| 120 | (Note that to get the physical scrolling effect on the terminal, it is |
| 121 | also necessary to call \fBidlok\fP). |
| 122 | .SS "setscrreg, wsetscrreg" |
| 123 | The \fBsetscrreg\fP and \fBwsetscrreg\fP routines allow the application |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 124 | programmer to set a software scrolling region in a window. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 125 | The \fItop\fP and |
| 126 | \fIbot\fP parameters |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 127 | are the line numbers of the top and bottom margin of the scrolling |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 128 | region. |
| 129 | (Line 0 is the top line of the window.) If this option and |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 130 | \fBscrollok\fP are enabled, an attempt to move off the bottom margin line |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 131 | causes all lines in the scrolling region to scroll one line in the direction |
| 132 | of the first line. |
| 133 | Only the text of the window is scrolled. |
| 134 | (Note that this |
| 135 | has nothing to do with the use of a physical scrolling region capability in the |
| 136 | terminal, like that in the VT100. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 137 | If \fBidlok\fP is enabled and the terminal |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 138 | has either a scrolling region or insert/delete line capability, they will |
| 139 | probably be used by the output routines.) |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 140 | .SH RETURN VALUE |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 141 | The functions \fBsetscrreg\fP and \fBwsetscrreg\fP return \fBOK\fP upon success |
| 142 | and \fBERR\fP upon failure. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 143 | All other routines that return an integer always |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 144 | return \fBOK\fP. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 145 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 146 | X/Open Curses does not specify any error conditions. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 147 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 148 | In this implementation, |
| 149 | .bP |
| 150 | those functions that have a window pointer |
| 151 | will return an error if the window pointer is null |
| 152 | .bP |
| 153 | \fBwsetscrreg\fP |
| 154 | returns an error if the scrolling region limits extend outside the |
| 155 | window boundaries. |
| 156 | .SH NOTES |
| 157 | Note that |
| 158 | \fBclearok\fP, |
| 159 | \fBleaveok\fP, |
| 160 | \fBscrollok\fP, |
| 161 | \fBidcok\fP, and |
| 162 | \fBsetscrreg\fP may be macros. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 163 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 164 | The \fBimmedok\fP routine is useful for windows that are used as terminal |
| 165 | emulators. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 166 | .SH PORTABILITY |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 167 | These functions are described in X/Open Curses, Issue 4. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 168 | .PP |
| 169 | Some historic curses implementations had, as an undocumented feature, the |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 170 | ability to do the equivalent of \fBclearok(..., 1)\fP by saying |
| 171 | \fBtouchwin(stdscr)\fP or \fBclear(stdscr)\fP. |
| 172 | This will not work under \fI\%ncurses\fP. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 173 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 174 | Earlier System V curses implementations specified that with \fBscrollok\fP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 175 | enabled, any window modification triggering a scroll also forced a physical |
| 176 | refresh. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 177 | X/Open Curses does not require this, and \fI\%ncurses\fP avoids doing |
| 178 | it to perform better vertical-motion optimization at \fBwrefresh\fP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 179 | time. |
| 180 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 181 | X/Open Curses does not mention that the cursor should be |
| 182 | made invisible as a side-effect of \fBleaveok\fP. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 183 | SVr4 curses documentation does this, but the code does not. |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 184 | Use \fBcurs_set\fP to make the cursor invisible. |
| 185 | .SH HISTORY |
| 186 | .I \%ncurses |
| 187 | formerly treated \fBnl\fP(3X) and \fBnonl\fP(3X) as both input |
| 188 | .I and |
| 189 | output options, |
| 190 | but no longer; |
| 191 | see \fB\%curs_inopts\fP(3X). |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 192 | .SH SEE ALSO |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 193 | \fB\%curses\fP(3X), |
| 194 | \fB\%curs_addch\fP(3X), |
| 195 | \fB\%curs_clear\fP(3X), |
| 196 | \fB\%curs_initscr\fP(3X), |
| 197 | \fB\%curs_refresh\fP(3X), |
| 198 | \fB\%curs_scroll\fP(3X), |
| 199 | \fB\%curs_variables\fP(3X) |