blob: 9433c6148583bcc421f253134e28cd27e2ea7e54 [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301'\" t
2.\"***************************************************************************
micky3879b9f5e72025-07-08 18:04:53 -04003.\" Copyright 2018-2023,2024 Thomas E. Dickey *
4.\" Copyright 1998-2016,2017 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05305.\" *
6.\" Permission is hereby granted, free of charge, to any person obtaining a *
7.\" copy of this software and associated documentation files (the *
8.\" "Software"), to deal in the Software without restriction, including *
9.\" without limitation the rights to use, copy, modify, merge, publish, *
10.\" distribute, distribute with modifications, sublicense, and/or sell *
11.\" copies of the Software, and to permit persons to whom the Software is *
12.\" furnished to do so, subject to the following conditions: *
13.\" *
14.\" The above copyright notice and this permission notice shall be included *
15.\" in all copies or substantial portions of the Software. *
16.\" *
17.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
18.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
19.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
20.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
21.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
22.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
23.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24.\" *
25.\" Except as contained in this notice, the name(s) of the above copyright *
26.\" holders shall not be used in advertising or otherwise to promote the *
27.\" sale, use or other dealings in this Software without prior written *
28.\" authorization. *
29.\"***************************************************************************
30.\"
micky3879b9f5e72025-07-08 18:04:53 -040031.\" $Id: curs_getch.3x,v 1.87 2024/04/20 19:18:18 tom Exp $
32.TH curs_getch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
33.ie \n(.g \{\
34.ds `` \(lq
35.ds '' \(rq
36.ds ^ \(ha
37.\}
38.el \{\
39.ie t .ds `` ``
40.el .ds `` ""
41.ie t .ds '' ''
42.el .ds '' ""
43.ds ^ ^
44.\}
45.
46.ie \n(.g .ds : \:
47.el .ds : \" empty
48.
Steve Kondikae271bc2015-11-15 02:50:53 +010049.de bP
micky3879b9f5e72025-07-08 18:04:53 -040050.ie n .IP \(bu 4
51.el .IP \(bu 2
Steve Kondikae271bc2015-11-15 02:50:53 +010052..
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053053.SH NAME
micky3879b9f5e72025-07-08 18:04:53 -040054\fB\%getch\fP,
55\fB\%wgetch\fP,
56\fB\%mvgetch\fP,
57\fB\%mvwgetch\fP,
58\fB\%ungetch\fP,
59\fB\%has_key\fP \-
60get (or push back) characters from \fIcurses\fR terminal keyboard
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053061.SH SYNOPSIS
micky3879b9f5e72025-07-08 18:04:53 -040062.nf
63.B #include <curses.h>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053064.PP
micky3879b9f5e72025-07-08 18:04:53 -040065.B int getch(void);
66.B int wgetch(WINDOW *\fIwin\fP);
67.B int mvgetch(int \fIy\fP, int \fIx\fP);
68.B int mvwgetch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP);
69.PP
70.B int ungetch(int \fIc\fP);
71.PP
72.\" XXX: Move has_key into its own page like define_key and key_defined?
73\fI/* extension */\fP
74.B int has_key(int \fIc\fP);
75.fi
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053076.SH DESCRIPTION
micky3879b9f5e72025-07-08 18:04:53 -040077.SS "Reading Characters"
78.B \%wgetch
79gathers a key stroke from the terminal keyboard associated with a
80.I curses
81window
82.IR win .
83\fB\%ncurses\fP(3X) describes the variants of this function.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053084.PP
micky3879b9f5e72025-07-08 18:04:53 -040085When input is pending,
86.B \%wgetch
87returns an integer identifying the key stroke;
88for alphanumeric and punctuation keys,
89this value corresponds to the character encoding used by the terminal.
90Use of the control key as a modifier often results in a distinct code.
91The behavior of other keys depends on whether
92.I win
93is in keypad mode;
94see subsection \*(``Keypad Mode\*('' below.
95.PP
96If no input is pending,
97then if the no-delay flag is set in the window
98(see \fB\%nodelay\fP(3X)),
99the function returns
100.BR ERR ;
101otherwise,
102.I curses
103waits until the terminal has input.
104If \fB\%cbreak\fP(3X)
105has been called,
106this happens after one character is read.
107If \fB\%nocbreak\fP(3X)
108has been called,
109it occurs when the next newline is read.
110If \fB\%halfdelay\fP(3X)
111has been called,
112.I curses
113waits until a character is typed or the specified delay elapses.
114.PP
115If \fB\%echo\fP(3X) has been called,
116and the window is not a pad,
117.I curses
118writes the returned character
119.I c
120to the window
121(at the cursor position)
122per the following rules.
Steve Kondikae271bc2015-11-15 02:50:53 +0100123.bP
micky3879b9f5e72025-07-08 18:04:53 -0400124If
125.I c
126matches the terminal's erase character,
127the cursor moves leftward one position
128and the new position is erased
129as if \fB\%wmove\fP(3X) and then \fB\%wdelch\fP(3X) were called.
130When the window's keypad mode is enabled
131(see below),
132.B \%KEY_LEFT
133and
134.B \%KEY_BACKSPACE
135are handled the same way.
Steve Kondikae271bc2015-11-15 02:50:53 +0100136.bP
micky3879b9f5e72025-07-08 18:04:53 -0400137.I curses
138writes any other
139.I c
140to the window,
141as with \fB\%wechochar\fP(3X).
Steve Kondikae271bc2015-11-15 02:50:53 +0100142.bP
micky3879b9f5e72025-07-08 18:04:53 -0400143If the window has been moved or modified since the last call to
144\fB\%wrefresh\fP(3X),
145.I curses
146calls
147.BR \%wrefresh .
148.PP
149If
150.I c
151is a carriage return and \fBnl\fP(3X) has been called,
152.B \%wgetch
153returns the character code for line feed instead.
154.SS "Keypad Mode"
155To
156.IR curses ,
157key strokes not from the alphabetic section of the keyboard
158(those corresponding to the ECMA-6 character set\(emsee
159\fIascii\fP(7)\(emoptionally modified by either the control or shift
160keys)
161are treated as
162.I function
163keys.
164(In
165.IR curses ,
166the term \*(``function key\*('' includes but is not limited to keycaps
167engraved with \*(``F1\*('',
168\*(``PF1\*('',
169and so on.)
170If the window is in keypad mode,
171these produce a numeric code corresponding to the
172.B KEY_
173symbols listed in subsection \*(``Predefined Key Codes\*('' below;
174otherwise,
175they transmit a sequence of codes typically starting with the escape
176character,
177and which must be collected with multiple
178.B \%wgetch
179calls.
Steve Kondikae271bc2015-11-15 02:50:53 +0100180.bP
micky3879b9f5e72025-07-08 18:04:53 -0400181The
182.I \%curses.h
183header file declares many
184.I "predefined function keys"
185whose names begin with
186.BR KEY_ ;
187these object-like macros have values outside the range of eight-bit
188character codes.
189.bP
190In
191.IR \%ncurses ,
192.I "user-defined function keys"
193are configured with \fB\%define_key\fP(3X);
194they have no names,
195but are also expected to have values outside the range of eight-bit
196codes.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530197.PP
micky3879b9f5e72025-07-08 18:04:53 -0400198A variable intended to hold a function key code must thus be of type
199.I short
200or larger.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530201.PP
micky3879b9f5e72025-07-08 18:04:53 -0400202Most terminals one encounters follow the ECMA-48 standard insofar as
203their function keys produce character sequences prefixed with the
204escape character ESC.
205This fact implies that
206.I curses
207cannot know whether the terminal has sent an ESC key stroke or the
208beginning of a function key's character sequence without waiting to see
209if,
210and how soon,
211further input arrives.
212When
213.I curses
214reads such an ambiguous character,
215it sets a timer.
216If the remainder of the sequence does not arrive within the designated
217time,
218.B \%wgetch
219returns the prefix character;
220otherwise,
221it returns the function key code corresponding to the unique sequence
222defined by the terminal.
223Consequently,
224a user of a
225.I curses
226application may experience a delay after pressing ESC while
227.I curses
228disambiguates the input;
229see section \*(``EXTENSIONS\*('' below.
230If the window is in \*(``no time-out\*('' mode,
231the timer does not expire;
232it is an infinite
233(or very large)
234value.
235See \fB\%notimeout\fP(3X).
236Because function key sequences usually begin with an escape character,
237the terminal may appear to hang in no time-out mode after the user has
238pressed ESC.
239Generally,
240further typing \*(``awakens\*(''
241.IR curses .
242.SS "Ungetting Characters"
243.B \%ungetch
244places
245.I c
246into the input queue to be returned by the next call to
247.BR \%wgetch .
248A single input queue serves all windows.
249.SS "Predefined Key Codes"
250The header file
251.I \%curses.h
252defines the following function key codes.
253.bP
254Except for the special case of
255.BR \%KEY_RESIZE ,
256a window's keypad mode must be enabled for
257.B \%wgetch
258to read these codes from it.
259.bP
Steve Kondikae271bc2015-11-15 02:50:53 +0100260Not all of these are necessarily supported on any particular terminal.
micky3879b9f5e72025-07-08 18:04:53 -0400261.bP
262The naming convention may seem obscure,
263with some apparent misspellings
264(such as \*(``RSUME\*('' for \*(``resume\*('');
265the names correspond to the
266.I \%term\%info
267capability names for the keys,
268and were standardized before the IBM PC/AT keyboard layout achieved a
269dominant position in industry.
Steve Kondikae271bc2015-11-15 02:50:53 +0100270.PP
micky3879b9f5e72025-07-08 18:04:53 -0400271.RS
272.\" XXX: Move this list into ncurses(3X), rather than duplicating it in
273.\" get_wch(3X) or having that page cross reference this one?
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530274.TS
micky3879b9f5e72025-07-08 18:04:53 -0400275Lb Lb
276Lb Lx.
277Symbol Key name
278=
279KEY_BREAK Break key
280KEY_DOWN Arrow keys
281KEY_UP \^
282KEY_LEFT \^
283KEY_RIGHT \^
284KEY_HOME Home key (upward+left arrow)
285KEY_BACKSPACE Backspace
286KEY_F0 T{
287Function keys; space for 64 keys is reserved
288T}
289KEY_F(\fIn\fP) T{
290Function key \fIn\fP where 0 \(<= \fIn\fP \(<= 63
291T}
292KEY_DL Delete line
293KEY_IL Insert line
294KEY_DC Delete character
295KEY_IC Insert character/Enter insert mode
296KEY_EIC Exit insert character mode
297KEY_CLEAR Clear screen
298KEY_EOS Clear to end of screen
299KEY_EOL Clear to end of line
300KEY_SF Scroll one line forward
301KEY_SR Scroll one line backward (reverse)
302KEY_NPAGE Next page/Page up
303KEY_PPAGE Previous page/Page down
304KEY_STAB Set tab
305KEY_CTAB Clear tab
306KEY_CATAB Clear all tabs
307KEY_ENTER Enter/Send
308KEY_SRESET Soft (partial) reset
309KEY_RESET (Hard) reset
310KEY_PRINT Print/Copy
311KEY_LL Home down/Bottom (lower left)
312KEY_A1 Upper left of keypad
313KEY_A3 Upper right of keypad
314KEY_B2 Center of keypad
315KEY_C1 Lower left of keypad
316KEY_C3 Lower right of keypad
317KEY_BTAB Back tab key
318KEY_BEG Beg(inning) key
319KEY_CANCEL Cancel key
320KEY_CLOSE Close key
321KEY_COMMAND Cmd (command) key
322KEY_COPY Copy key
323KEY_CREATE Create key
324KEY_END End key
325KEY_EXIT Exit key
326KEY_FIND Find key
327KEY_HELP Help key
328KEY_MARK Mark key
329KEY_MESSAGE Message key
330KEY_MOUSE Mouse event occurred
331KEY_MOVE Move key
332KEY_NEXT Next object key
333KEY_OPEN Open key
334KEY_OPTIONS Options key
335KEY_PREVIOUS Previous object key
336KEY_REDO Redo key
337KEY_REFERENCE Ref(erence) key
338KEY_REFRESH Refresh key
339KEY_REPLACE Replace key
340KEY_RESIZE Screen resized
341KEY_RESTART Restart key
342KEY_RESUME Resume key
343KEY_SAVE Save key
344KEY_SELECT Select key
345KEY_SUSPEND Suspend key
346KEY_UNDO Undo key
Steve Kondikae271bc2015-11-15 02:50:53 +0100347_
micky3879b9f5e72025-07-08 18:04:53 -0400348KEY_SBEG Shifted beginning key
349KEY_SCANCEL Shifted cancel key
350KEY_SCOMMAND Shifted command key
351KEY_SCOPY Shifted copy key
352KEY_SCREATE Shifted create key
353KEY_SDC Shifted delete character key
354KEY_SDL Shifted delete line key
355KEY_SEND Shifted end key
356KEY_SEOL Shifted clear line key
357KEY_SEXIT Shifted exit key
358KEY_SFIND Shifted find key
359KEY_SHELP Shifted help key
360KEY_SHOME Shifted home key
361KEY_SIC Shifted insert key
362KEY_SLEFT Shifted left arrow key
363KEY_SMESSAGE Shifted message key
364KEY_SMOVE Shifted move key
365KEY_SNEXT Shifted next object key
366KEY_SOPTIONS Shifted options key
367KEY_SPREVIOUS Shifted previous object key
368KEY_SPRINT Shifted print key
369KEY_SREDO Shifted redo key
370KEY_SREPLACE Shifted replace key
371KEY_SRIGHT Shifted right arrow key
372KEY_SRSUME Shifted resume key
373KEY_SSAVE Shifted save key
374KEY_SSUSPEND Shifted suspend key
375KEY_SUNDO Shifted undo key
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530376.TE
micky3879b9f5e72025-07-08 18:04:53 -0400377.RE
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530378.PP
micky3879b9f5e72025-07-08 18:04:53 -0400379Many keyboards feature a nine-key directional pad.
380.PP
381.RS
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530382.TS
micky3879b9f5e72025-07-08 18:04:53 -0400383allbox center;
384C C C.
385A1 up A3
386left B2 right
387C1 down C3
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530388.TE
micky3879b9f5e72025-07-08 18:04:53 -0400389.RE
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530390.sp
micky3879b9f5e72025-07-08 18:04:53 -0400391Two of the symbols in the list above do
392.I not
393correspond to a physical key.
Steve Kondikae271bc2015-11-15 02:50:53 +0100394.bP
micky3879b9f5e72025-07-08 18:04:53 -0400395.B \%wgetch
396returns
397.BR \%KEY_RESIZE ,
398even if the window's keypad mode is disabled,
399when
400.I \%ncurses
401handles a
402.B \%SIGWINCH
403signal;
404see \fB\%initscr\fP(3X) and \fB\%resizeterm\fP(3X).
Steve Kondikae271bc2015-11-15 02:50:53 +0100405.bP
micky3879b9f5e72025-07-08 18:04:53 -0400406.B \%wgetch
407returns
408.B \%KEY_MOUSE
409to indicate that a mouse event is pending collection;
410see \fB\%curs_mouse\fP(3X).
411Receipt of this code requires a window's keypad mode to be enabled,
412because to interpret mouse input
413(as with with \fI\%xterm\fP(1)'s mouse prototocol),
414.I \%ncurses
415must read an escape sequence,
416as with a function key.
417.SS "Testing Key Codes"
418In
419.IR \%ncurses ,
420.B \%has_key
421returns a Boolean value indicating whether the terminal type recognizes
422its parameter as a key code value.
423See also
424\fB\%define_key\fP(3X) and \fB\%key_defined\fP(3X).
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530425.SH RETURN VALUE
micky3879b9f5e72025-07-08 18:04:53 -0400426Except for
427.BR \%has_key ,
428these functions return
429.B OK
430on success and
431.B ERR
432on failure.
Steve Kondikae271bc2015-11-15 02:50:53 +0100433.PP
micky3879b9f5e72025-07-08 18:04:53 -0400434Functions taking a
435.I \%WINDOW
436pointer argument fail if the pointer is
437.BR NULL .
438.PP
439Functions prefixed with \*(``mv\*('' first perform cursor movement and
440fail if the position
441.RI ( y ,
442.IR x )
443is outside the window boundaries.
444.PP
445.B \%wgetch
446also fails if
447.bP
448its timeout expires without any data arriving,
449or
450.bP
451execution was interrupted by a signal,
452in which case
453.B \%errno
454is set to
455.BR \%EINTR .
456.PP
457.B \%ungetch
458fails if there is no more room in the input queue.
459.PP
460.B \%has_key
461returns
462.B TRUE
463or
464.BR FALSE .
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530465.SH NOTES
micky3879b9f5e72025-07-08 18:04:53 -0400466.I curses
467discourages assignment of the ESC key to a discrete function by the
468programmer because the library requires a delay while it awaits the
469potential remainder of a terminal escape sequence.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530470.PP
micky3879b9f5e72025-07-08 18:04:53 -0400471Some key strokes are indistinguishable from control characters;
472for example,
473.B \%KEY_ENTER
474may be the same as
475.BR \*^M ,
476.\" as with att630 or pccon+keys
477and
478.B \%KEY_BACKSPACE
479may be the same as
480.B \*^H
481.\" as with att505 or vt52-basic
482or
483.BR \*^? .
484.\" as with pccon+keys or vt320
485Consult the terminal's
486.I \%term\%info
487entry to determine whether this is the case;
488see \fB\%infocmp\fP(1).
489Some
490.I curses
491implementations,
492including
493.IR \%ncurses ,
494honor the
495.I \%term\%info
496key definitions;
497others treat such control characters specially.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530498.PP
micky3879b9f5e72025-07-08 18:04:53 -0400499.I curses
500distinguishes the Enter keys in the alphabetic and numeric keypad
501sections of a keyboard because (most) terminals do.
502.B \%KEY_ENTER
503refers to the key on the numeric keypad and,
504like other function keys,
505and is reliably recognized only if the window's keypad mode is enabled.
Steve Kondikae271bc2015-11-15 02:50:53 +0100506.bP
micky3879b9f5e72025-07-08 18:04:53 -0400507The
508.I \%term\%info
509.B \%key_enter
510.RB ( kent )
511capability describes the character (sequence) sent by the Enter key of
512a terminal's numeric
513(or similar)
514keypad.
Steve Kondikae271bc2015-11-15 02:50:53 +0100515.bP
micky3879b9f5e72025-07-08 18:04:53 -0400516\*(``Enter or send\*('' is X/Open Curses's description of this key.
517.PP
518.I curses
519treats the Enter or Return key in the
520.I alphabetic
521section of the keyboard differently.
Steve Kondikae271bc2015-11-15 02:50:53 +0100522.bP
micky3879b9f5e72025-07-08 18:04:53 -0400523It usually produces a control code for carriage return
524.RB ( \*^M )
525or line feed
526.RB ( \*^J ).
Steve Kondikae271bc2015-11-15 02:50:53 +0100527.bP
micky3879b9f5e72025-07-08 18:04:53 -0400528Depending on the terminal mode
529(raw,
530cbreak,
531or
532\*(``cooked\*(''),
533and whether \fB\%nl\fP(3X) or \fB\%nonl\fP(3X) has been called,
534.B \%wgetch
535may return either a carriage return or line feed upon an Enter or Return
536key stroke.
Steve Kondikae271bc2015-11-15 02:50:53 +0100537.PP
micky3879b9f5e72025-07-08 18:04:53 -0400538Use of
539.B \%wgetch
540with \fB\%echo\fP(3X) and neither \fB\%cbreak\fP(3X) nor \fB\%raw\fP(3X)
541is not well-defined.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530542.PP
micky3879b9f5e72025-07-08 18:04:53 -0400543Historically,
544the list of key code macros above was influenced by the
545function-key-rich keyboard of the AT&T 7300
546(also known variously as the \*(``3B1\*('', \*(``Safari 4\*('', and
547\*(``UNIX PC\*(''),
548a 1985 machine.
549Today's computer keyboards are based that of the IBM PC/AT and tend to
550have fewer.
551A
552.I curses
553application can expect such a keyboard to transmit key codes
554.BR \%KEY_UP ,
555.BR \%KEY_DOWN ,
556.BR \%KEY_LEFT ,
557.BR \%KEY_RIGHT ,
558.BR \%KEY_HOME ,
559.BR \%KEY_END ,
560.B \%KEY_PPAGE
561(Page Up),
562.B \%KEY_NPAGE
563(Page Down),
564.B \%KEY_IC
565(Insert),
566.B \%KEY_DC
567(Delete),
568and
569.BI \%KEY_F( n )
570for 1 \(<=
571.I n
572\(<= 12.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530573.PP
micky3879b9f5e72025-07-08 18:04:53 -0400574.BR \%getch ,
575.BR \%mvgetch ,
576and
577.B \%mvwgetch
578may be implemented as macros.
579.SH EXTENSIONS
580In
581.IR \%ncurses ,
582when a window's \*(``no time-out\*('' mode is
583.I not
584set,
585the
586.B \%ESCDELAY
587variable configures the duration of the timer used to disambiguate a
588function key character sequence from a series of key strokes beginning
589with ESC typed by the user;
590see
591\fB\%curs_variables\fP(3X).
592.PP
593\fB\%has_key\fP was designed for \fB\%ncurses\fP(3X),
594and is not found in SVr4
595.IR curses ,
5964.4BSD
597.IR curses ,
598or any other previous curses implementation.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530599.SH PORTABILITY
micky3879b9f5e72025-07-08 18:04:53 -0400600Applications employing
601.I \%ncurses
602extensions should condition their use on the visibility of the
603.B \%NCURSES_VERSION
604preprocessor macro.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530605.PP
micky3879b9f5e72025-07-08 18:04:53 -0400606X/Open Curses,
607Issue 4 describes
608\fB\%getch\fP,
609\fB\%wgetch\fP,
610\fB\%mvgetch\fP,
611\fB\%mvwgetch\fP,
612and
613\fB\%ungetch\fP.
614It specifies no error conditions for them.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530615.PP
micky3879b9f5e72025-07-08 18:04:53 -0400616.B \%wgetch
617reads only single-byte characters.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530618.PP
micky3879b9f5e72025-07-08 18:04:53 -0400619The echo behavior of these functions on input of
620.B KEY_
621or backspace characters was not specified in the SVr4 documentation.
622This description is adapted from X/Open Curses.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530623.PP
micky3879b9f5e72025-07-08 18:04:53 -0400624The behavior of
625.B \%wgetch
626in the presence of signal handlers is unspecified in the SVr4
627documentation and X/Open Curses.
628In historical
629.I curses
630implementations,
631it varied depending on whether the operating system's dispatch of a
632signal to a handler interrupting a \fIread\fP(2) call in progress,
633and also
634(in some implementations)
635whether an input timeout or non-blocking mode has been set.
636Programmers concerned about portability should be prepared for either of
637two cases:
638(a) signal receipt does not interrupt
639.BR \%wgetch ;
640or
641(b) signal receipt interrupts
642.B \%wgetch
643and causes it to return
644.B ERR
645with
646.B \%errno
647set to
648.BR \%EINTR .
649.PP
650.B \%KEY_MOUSE
651is mentioned in X/Open Curses,
652along with a few related
653.I \%term\%info
654capabilities,
655but no higher-level functions use the feature.
656The implementation in
657.I \%ncurses
658is an extension.
659.PP
660.B \%KEY_RESIZE
661and
662.B \%has_key
663are extensions first implemented for
664.IR \%ncurses .
665By 2022,
666.I \%PDCurses
667.\" https://web.archive.org/web/20220117232009/https://pdcurses.org/docs/MANUAL.html
668and
669NetBSD
670.I curses
671.\" https://web.archive.org/web/20200923185647/https://man.netbsd.org/curses_input.3
672had added them along with
673.BR \%KEY_MOUSE .
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530674.SH SEE ALSO
micky3879b9f5e72025-07-08 18:04:53 -0400675\fB\%curs_get_wch\fP(3X) describes comparable functions of the
676.I \%ncurses
677library in its wide-character configuration
678.RI ( \%ncursesw ).
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530679.PP
micky3879b9f5e72025-07-08 18:04:53 -0400680\fB\%curses\fP(3X),
681\fB\%curs_addch\fP(3X),
682\fB\%curs_inopts\fP(3X),
683\fB\%curs_mouse\fP(3X),
684\fB\%curs_move\fP(3X),
685\fB\%curs_outopts\fP(3X),
686\fB\%curs_refresh\fP(3X),
687\fB\%curs_variables\fP(3X),
688\fB\%resizeterm\fP(3X),
689\fB\%ascii\fP(7)
690.PP
691ECMA-6 \*(``7-bit coded Character Set\*(''
692\%<https://\*:ecma\-international\*:.org/\
693\*:publications\-and\-standards/\*:standards/\*:ecma\-6/>
694.PP
695ECMA-48 \*(``Control Functions for Coded Character Sets\*(''
696\%<https://\*:ecma\-international\*:.org/\
697\*:publications\-and\-standards/\*:standards/\*:ecma\-48/>