]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_variables.3x
ncurses 6.4 - patch 20230917
[ncurses.git] / man / curs_variables.3x
1 .\"***************************************************************************
2 .\" Copyright 2018-2021,2023 Thomas E. Dickey                                *
3 .\" Copyright 2010-2015,2017 Free Software Foundation, Inc.                  *
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 .\"
30 .\" $Id: curs_variables.3x,v 1.23 2023/09/16 23:37:03 tom Exp $
31 .TH curs_variables 3X 2023-09-16 "ncurses 6.4" "Library calls"
32 .ie \n(.g .ds `` \(lq
33 .el       .ds `` ``
34 .ie \n(.g .ds '' \(rq
35 .el       .ds '' ''
36 .de bP
37 .ie n  .IP \(bu 4
38 .el    .IP \(bu 2
39 ..
40 .ds n 5
41 .SH NAME
42 \fB\%COLORS\fP,
43 \fB\%COLOR_PAIRS\fP,
44 \fB\%COLS\fP,
45 \fB\%ESCDELAY\fP,
46 \fB\%LINES\fP,
47 \fB\%TABSIZE\fP,
48 \fB\%curscr\fP,
49 \fB\%newscr\fP,
50 \fB\%stdscr\fP \-
51 \fIcurses\fR global variables
52 .SH SYNOPSIS
53 .nf
54 \fB#include <curses.h>\fP
55 .PP
56 \fBint COLOR_PAIRS;\fP
57 .br
58 \fBint COLORS;\fP
59 .br
60 \fBint COLS;\fP
61 .br
62 \fBint ESCDELAY;\fP
63 .br
64 \fBint LINES;\fP
65 .br
66 \fBint TABSIZE;\fP
67 .br
68 \fBWINDOW * curscr;\fP
69 .br
70 \fBWINDOW * newscr;\fP
71 .br
72 \fBWINDOW * stdscr;\fP
73 .fi
74 .SH DESCRIPTION
75 This page summarizes variables provided by the \fBcurses\fP library.
76 A more complete description is given in the \fBcurses\fP(3X) manual page.
77 .PP
78 Depending on the configuration, these may be actual variables,
79 or macros (see \fBcurs_threads\fP(3X) and \fBcurs_opaque\fP(3X))
80 which provide read-only access to \fIcurses\fP's state.
81 In either case, applications should treat them as read-only to avoid
82 confusing the library.
83 .SS COLOR_PAIRS
84 After initializing curses, this variable contains the number of color pairs
85 which the terminal can support.
86 Usually the number of color pairs will be the product \fBCOLORS\fP*\fBCOLORS\fP,
87 however this is not always true:
88 .bP
89 a few terminals use HLS colors, which do not follow this rule
90 .bP
91 terminals supporting a large number of colors are limited by the number
92 of color pairs that can be represented in a \fIsigned short\fP value.
93 .SS COLORS
94 After initializing curses, this variable contains the number of colors
95 which the terminal can support.
96 .SS COLS
97 After initializing curses, this variable contains the width of the screen,
98 i.e., the number of columns.
99 .SS ESCDELAY
100 This variable holds the number of milliseconds to wait after reading an
101 escape character,
102 to distinguish between an individual escape character entered on the
103 keyboard from escape sequences sent by cursor- and function-keys
104 (see curses(3X)).
105 .SS LINES
106 After initializing curses, this variable contains the height of the screen,
107 i.e., the number of lines.
108 .SS TABSIZE
109 This variable holds the number of columns used by the \fIcurses\fP library
110 when converting a tab character to spaces as it adds the tab to a window
111 (see \fBcurs_addch\fP(3X).
112 .SS The Current Screen
113 This implementation of curses uses a special window \fBcurscr\fP to
114 record its updates to the terminal screen.
115 .PP
116 This is referred to as the \*(``physical screen\*('' in the
117 \fBcurs_refresh\fP(3X) and
118 \fBcurs_outopts\fP(3X) manual pages.
119 .SS The New Screen
120 This implementation of curses uses a special window \fBnewscr\fP to
121 hold updates to the terminal screen before applying them to \fBcurscr\fP.
122 .PP
123 This is referred to as the \*(``virtual screen\*('' in the
124 \fBcurs_kernel\fP(3X),
125 \fBcurs_refresh\fP(3X) and
126 \fBcurs_outopts\fP(3X) manual pages.
127 .SS The Standard Screen
128 Upon initializing curses,
129 a default window called \fBstdscr\fP,
130 which is the size of the terminal screen, is created.
131 Many curses functions use this window.
132 .SH NOTES
133 The curses library is initialized using either \fBinitscr\fP(3X),
134 or \fBnewterm\fP(3X).
135 .PP
136 If \fBcurses\fP is configured to use separate curses/terminfo libraries,
137 most of these variables reside in the curses library.
138 .SH PORTABILITY
139 \fBTABSIZE\fP is a feature of SVr4 curses
140 which is not documented by X/Open curses.
141 .bP
142 In SVr4 curses, \fBTABSIZE\fP is initially set from the terminal description's
143 \fBinit_tabs\fP capability.
144 After that, it can be altered by the applications using SVr4 curses.
145 .IP
146 SVr4 curses uses the current value of \fBTABSIZE\fP to
147 compute the position of tabstops for updating both
148 the virtual screen with \fBaddch\fP(3X) as well as
149 the physical screen with \fBmvcur\fP(3X).
150 .bP
151 This implementation uses the current value of \fBTABSIZE\fP only for
152 updating the virtual screen.
153 It uses the terminal description's \fBit\fP (\fBinit_tabs\fP) capability for
154 computing hardware tabs (i.e., tab stops on the physical screen).
155 .bP
156 Other implementations differ.
157 For instance, NetBSD curses allows \fBTABSIZE\fP to be set through
158 an environment variable.
159 This implementation does not.
160 .IP
161 NetBSD curses does not support hardware tabs;
162 it uses the \fBinit_tabs\fP capability and the \fBTABSIZE\fP variable
163 only for updating the virtual screen.
164 .PP
165 \fBESCDELAY\fP is an extension in AIX curses:
166 .bP
167 In AIX, the units for \fBESCDELAY\fP are \fIfifths\fP of a millisecond.
168 .bP
169 The default value for AIX's \fBESCDELAY\fP is 0.1 seconds.
170 .bP
171 AIX also enforces a limit of 10,000 seconds for \fBESCDELAY\fP;
172 this implementation currently has no upper limit.
173 .PP
174 This implementation has long used \fBESCDELAY\fP with units of milliseconds,
175 making it impossible to be completely compatible with AIX.
176 Likewise, most users have either decided to override the value,
177 or rely upon its default value.
178 .SH SEE ALSO
179 \fBcurses\fP(3X),
180 \fBcurs_opaque\fP(3X),
181 \fBcurs_terminfo\fP(3X),
182 \fBcurs_threads\fP(3X),
183 \fBterm_variables\fP(3X),
184 \fBterminfo\fP(\*n).