Debian Codegraph @

upstream/opensuse-leap-16-1/man3/getch.3ncurses

raw
1 '\" t
2 .\"***************************************************************************
3 .\" Copyright 2018-2024,2025 Thomas E. Dickey *
4 .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. *
5 .\" *
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 .\"
31 .\" $Id: curs_getch.3x,v 1.127 2025/04/05 22:04:30 tom Exp $
32 .TH getch 3NCURSES 2025-04-05 "ncurses 6.5" "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 .
49 .de bP
50 .ie n .IP \(bu 4
51 .el .IP \(bu 2
52 ..
53 .SH NAME
54 \fB\%getch\fP,
55 \fB\%wgetch\fP,
56 \fB\%mvgetch\fP,
57 \fB\%mvwgetch\fP,
58 \fB\%ungetch\fP,
59 \fB\%has_key\fP \-
60 get (or push back) characters from \fIcurses\fR terminal keyboard buffer
61 .SH SYNOPSIS
62 .nf
63 .B #include <ncursesw/curses.h>
64 .PP
65 .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
76 .SH DESCRIPTION
77 .SS "Reading Characters"
78 .B \%wgetch
79 gathers a key event from the terminal keyboard associated with a
80 .I curses
81 window
82 .IR win "."
83 \fB\%ncurses\fP(3NCURSES) describes the variants of this function.
84 .PP
85 When input is pending,
86 .B \%wgetch
87 returns an integer identifying the key event;
88 for alphanumeric and punctuation keys,
89 this value corresponds to the character encoding used by the terminal.
90 Use of the control key as a modifier,
91 by holding it down while pressing and releasing another key,
92 often results in a distinct code.
93 The behavior of other keys depends on whether
94 .I win
95 is in keypad mode;
96 see subsection \*(``Keypad Mode\*('' below.
97 .PP
98 If no input is pending,
99 then if the no-delay flag is set in the window
100 (see \fB\%nodelay\fP(3NCURSES)),
101 the function returns
102 .BR ERR ";"
103 otherwise,
104 .I curses
105 waits until the terminal has input.
106 If \fB\%cbreak\fP(3NCURSES) or \fB\%raw\fP(3NCURSES)
107 has been called,
108 this happens after one character is read.
109 If \fB\%nocbreak\fP(3NCURSES) or \fB\%noraw\fP(3NCURSES)
110 has been called,
111 it occurs when the next newline is read.
112 (Because the terminal's canonical or \*(``cooked\*('' mode
113 is line-buffered,
114 multiple
115 .B \%wgetch
116 calls may then be necessary to empty the input queue.)
117 If \fB\%halfdelay\fP(3NCURSES)
118 has been called,
119 .I curses
120 waits until input is available or the specified delay elapses.
121 .PP
122 If \fB\%echo\fP(3NCURSES) has been called,
123 and the window is not a pad,
124 .I curses
125 writes the returned character
126 .I c
127 to the window
128 (at the cursor position)
129 per the following rules.
130 .bP
131 If
132 .I c
133 matches the terminal's erase character
134 (see \fB\%erasechar\fP(3NCURSES)),
135 the cursor moves leftward one position
136 and the new position is erased
137 as if \fB\%wmove\fP(3NCURSES) and then \fB\%wdelch\fP(3NCURSES) were called.
138 When the window's keypad mode is enabled
139 (see below),
140 .B \%KEY_LEFT
141 and
142 .B \%KEY_BACKSPACE
143 are handled the same way.
144 .bP
145 .I curses
146 writes any other
147 .I c
148 to the window,
149 as with \fB\%wechochar\fP(3NCURSES).
150 .bP
151 If the window
152 .I win
153 has been moved or modified since the last call to
154 \fB\%wrefresh\fP(3NCURSES),
155 .I curses
156 calls
157 .B \%wrefresh
158 on it.
159 .PP
160 If
161 .I c
162 is a carriage return and \fBnl\fP(3NCURSES) has been called,
163 .B \%wgetch
164 returns the character code for line feed instead.
165 .SS "Keypad Mode"
166 Call \fB\%keypad\fP(3NCURSES) on a window to configure keypad mode
167 when reading input from it.
168 In
169 .IR "keypad mode" ","
170 .I curses
171 treats key strokes not from the alphabetic section of the keyboard
172 (those corresponding to the ECMA-6 character set \(em
173 see \fI\%ascii\fP(7) \(em
174 optionally modified by either the control or shift keys)
175 as
176 .I function
177 keys.
178 (In
179 .IR curses ","
180 the term \*(``function key\*('' includes but is not limited to keycaps
181 engraved with \*(``F1\*('',
182 \*(``PF1\*('',
183 and so on.)
184 If a window is in keypad mode,
185 .B \%wgetch
186 translates these key strokes to a numeric code corresponding to the
187 .B KEY_
188 symbols listed in subsection \*(``Predefined Key Codes\*('' below.
189 If a window is not in keypad mode,
190 .B \%wgetch
191 returns a sequence of codes
192 typically starting with the escape character,
193 which the application must collect individually with multiple
194 .B \%wgetch
195 calls.
196 .bP
197 The
198 .I \%curses.h
199 header file declares many
200 .I "predefined function keys"
201 whose names begin with
202 .BR KEY_ ";"
203 these object-like macros
204 have integer values outside the range of eight-bit character codes.
205 .bP
206 In
207 .IR \%ncurses ","
208 .I "user-defined function keys"
209 are configured with \fB\%define_key\fP(3NCURSES);
210 they have no names,
211 but are also expected to
212 have integer values outside the range of eight-bit character codes.
213 .PP
214 A variable intended to hold a function key code must thus be of type
215 .I short
216 or larger.
217 .PP
218 Most terminals one encounters follow the ECMA-48 standard insofar as
219 their function keys produce character sequences prefixed with the
220 escape character ESC.
221 This fact implies that
222 .I curses
223 cannot distinguish a user's press of the escape key
224 (assuming it sends ESC)
225 from the beginning of a function key's character sequence without
226 waiting to see if,
227 and how soon,
228 further input arrives.
229 .bP
230 If the escape sequence
231 matches a string capability defining a function key
232 for the terminal type
233 (such as
234 .B \%key_home
235 .RB \%( khome )
236 or
237 .B \%key_up
238 .RB \%( kuu1 )),
239 .B \%wgetch
240 returns the function key code corresponding to the unique sequence
241 defined by the terminal.
242 .bP
243 If the escape sequence matches no function keys
244 defined for the terminal type,
245 call
246 .B \%wgetch
247 repeatedly to obtain
248 the codes of the individual characters of the sequence,
249 in the order they occurred in the input.
250 .bP
251 If
252 .B \%wgetch
253 cannot decide the validity of the input as a function key
254 because it has not read enough characters to disambiguate it,
255 the function waits until it has this information or the
256 .I "escape delay"
257 elapses.
258 Configure the escape delay
259 with the global variable
260 .IR \%ESCDELAY ","
261 an extension
262 (see section \*(``EXTENSIONS\*('' below),
263 or the environment variable of the same name
264 (see section \*(``ENVIRONMENT\*('' of \fB\%ncurses\fP(3NCURSES)),
265 also an extension.
266 .PP
267 Consequently,
268 a user of a
269 .I curses
270 application that employs keypad mode
271 may experience a pause or \*(``hang\*(''
272 after pressing the escape key while
273 .I curses
274 collects sufficient characters to disambiguate the input.
275 If the window is in \*(``no time-out\*('' mode,
276 the escape delay is effectively infinite;
277 see \fB\%notimeout\fP(3NCURSES).
278 In the event of such a pause,
279 further typing \*(``awakens\*(''
280 .IR curses "."
281 .SS "Ungetting Characters"
282 .B \%ungetch
283 places
284 .I c
285 into the input queue to be returned by the next call to
286 .BR \%wgetch "."
287 A single input queue serves all windows associated with the screen.
288 .SS "Predefined Key Codes"
289 The header file
290 .I \%curses.h
291 defines the following function key codes.
292 .bP
293 Except for the special case of
294 .BR \%KEY_RESIZE ","
295 a window's keypad mode must be enabled for
296 .B \%wgetch
297 to read these codes from it.
298 .bP
299 Not all of these are necessarily supported on any particular terminal.
300 .bP
301 The naming convention may seem obscure,
302 with some apparent misspellings
303 (such as \*(``RSUME\*('' for \*(``resume\*('');
304 the names correspond to the
305 .I \%term\%info
306 capability names for the keys,
307 and were standardized before the IBM PC/AT keyboard layout achieved a
308 dominant position in industry.
309 .PP
310 .RS
311 .\" XXX: Move this list into ncurses(3X), rather than duplicating it in
312 .\" get_wch(3X) or having that page cross reference this one?
313 .TS
314 Lb Lb
315 Lb Lx.
316 Symbol Key name
317 =
318 KEY_BREAK Break key
319 .ne 4
320 KEY_DOWN Arrow keys
321 KEY_UP \^
322 KEY_LEFT \^
323 KEY_RIGHT \^
324 KEY_HOME Home key (upward+left arrow)
325 KEY_BACKSPACE Backspace
326 KEY_F0 T{
327 Function keys; space for 64 keys is reserved
328 T}
329 KEY_F(\fIn\fP) T{
330 Function key \fIn\fP where 0 \(<= \fIn\fP \(<= 63
331 T}
332 KEY_DL Delete line
333 KEY_IL Insert line
334 KEY_DC Delete character
335 KEY_IC Insert character/Enter insert mode
336 KEY_EIC Exit insert character mode
337 KEY_CLEAR Clear screen
338 KEY_EOS Clear to end of screen
339 KEY_EOL Clear to end of line
340 KEY_SF Scroll one line forward
341 KEY_SR Scroll one line backward (reverse)
342 KEY_NPAGE Next page/Page up
343 KEY_PPAGE Previous page/Page down
344 KEY_STAB Set tab
345 KEY_CTAB Clear tab
346 KEY_CATAB Clear all tabs
347 KEY_ENTER Enter/Send
348 KEY_SRESET Soft (partial) reset
349 KEY_RESET (Hard) reset
350 KEY_PRINT Print/Copy
351 KEY_LL Home down/Bottom (lower left)
352 KEY_A1 Upper left of keypad
353 KEY_A3 Upper right of keypad
354 KEY_B2 Center of keypad
355 KEY_C1 Lower left of keypad
356 KEY_C3 Lower right of keypad
357 KEY_BTAB Back tab key
358 KEY_BEG Beg(inning) key
359 KEY_CANCEL Cancel key
360 KEY_CLOSE Close key
361 KEY_COMMAND Cmd (command) key
362 KEY_COPY Copy key
363 KEY_CREATE Create key
364 KEY_END End key
365 KEY_EXIT Exit key
366 KEY_FIND Find key
367 KEY_HELP Help key
368 KEY_MARK Mark key
369 KEY_MESSAGE Message key
370 KEY_MOUSE Mouse event occurred
371 KEY_MOVE Move key
372 KEY_NEXT Next object key
373 KEY_OPEN Open key
374 KEY_OPTIONS Options key
375 KEY_PREVIOUS Previous object key
376 KEY_REDO Redo key
377 KEY_REFERENCE Ref(erence) key
378 KEY_REFRESH Refresh key
379 KEY_REPLACE Replace key
380 KEY_RESIZE Screen resized
381 KEY_RESTART Restart key
382 KEY_RESUME Resume key
383 KEY_SAVE Save key
384 KEY_SELECT Select key
385 KEY_SUSPEND Suspend key
386 KEY_UNDO Undo key
387 _
388 KEY_SBEG Shifted beginning key
389 KEY_SCANCEL Shifted cancel key
390 KEY_SCOMMAND Shifted command key
391 KEY_SCOPY Shifted copy key
392 KEY_SCREATE Shifted create key
393 KEY_SDC Shifted delete character key
394 KEY_SDL Shifted delete line key
395 KEY_SEND Shifted end key
396 KEY_SEOL Shifted clear line key
397 KEY_SEXIT Shifted exit key
398 KEY_SFIND Shifted find key
399 KEY_SHELP Shifted help key
400 KEY_SHOME Shifted home key
401 KEY_SIC Shifted insert key
402 KEY_SLEFT Shifted left arrow key
403 KEY_SMESSAGE Shifted message key
404 KEY_SMOVE Shifted move key
405 KEY_SNEXT Shifted next object key
406 KEY_SOPTIONS Shifted options key
407 KEY_SPREVIOUS Shifted previous object key
408 KEY_SPRINT Shifted print key
409 KEY_SREDO Shifted redo key
410 KEY_SREPLACE Shifted replace key
411 KEY_SRIGHT Shifted right arrow key
412 KEY_SRSUME Shifted resume key
413 KEY_SSAVE Shifted save key
414 KEY_SSUSPEND Shifted suspend key
415 KEY_SUNDO Shifted undo key
416 .TE
417 .RE
418 .PP
419 Many keyboards feature a nine-key directional pad.
420 .PP
421 .RS
422 .TS
423 allbox center;
424 C C C.
425 A1 up A3
426 left B2 right
427 C1 down C3
428 .TE
429 .RE
430 .sp
431 Two of the symbols in the list above do
432 .I not
433 correspond to a physical key.
434 .bP
435 .B \%wgetch
436 returns
437 .BR \%KEY_RESIZE ","
438 even if the window's keypad mode is disabled,
439 if
440 .I \%ncurses
441 has handled a
442 .B \%SIGWINCH
443 signal since
444 .B \%wgetch
445 was called;
446 see \fB\%initscr\fP(3NCURSES) and \fB\%resizeterm\fP(3NCURSES).
447 .bP
448 .B \%wgetch
449 returns
450 .B \%KEY_MOUSE
451 to indicate that a mouse event is pending collection;
452 see \fB\%mouse\fP(3NCURSES).
453 Receipt of this code requires a window's keypad mode to be enabled,
454 because to interpret mouse input
455 (as with \fI\%xterm\fP(1)'s mouse protocol),
456 .I \%ncurses
457 must read an escape sequence,
458 as with a function key.
459 .SS "Testing Key Codes"
460 In
461 .IR \%ncurses ","
462 .B \%has_key
463 returns a Boolean value indicating whether the terminal type recognizes
464 its parameter as a key code value.
465 See also
466 \fB\%define_key\fP(3NCURSES) and \fB\%key_defined\fP(3NCURSES).
467 .SH RETURN VALUE
468 .B \%wgetch
469 returns a key code identifying the key event as described above,
470 which may include
471 .B \%KEY_RESIZE
472 or
473 .B \%KEY_MOUSE
474 indicating non-key events,
475 or
476 .B ERR
477 on failure.
478 .B \%wgetch
479 fails if
480 its timeout expires without any data arriving,
481 which cannot happen if \fB\%nodelay\fP(3NCURSES) is in effect on the window.
482 .PP
483 In
484 .IR \%ncurses ,
485 .B \%wgetch
486 also fails if
487 .bP
488 the
489 .I curses
490 screen has not been initialized,
491 .bP
492 (for functions taking a
493 .I \%WINDOW
494 pointer argument)
495 .I win
496 is a null pointer,
497 or
498 .bP
499 execution was interrupted by a signal,
500 in which case
501 .I \%errno
502 is set to
503 .IR \%EINTR "."
504 .PP
505 Functions prefixed with \*(``mv\*('' first perform cursor movement and
506 fail if the position
507 .RI ( y ,
508 .IR x ")"
509 is outside the window boundaries.
510 .PP
511 .B \%ungetch
512 returns
513 .B OK
514 on success and
515 .B ERR
516 on failure.
517 In
518 .IR \%ncurses ,
519 .B \%ungetch
520 fails if
521 .bP
522 the
523 .I curses
524 screen has not been initialized,
525 or
526 .bP
527 there is no more room in the input queue.
528 .PP
529 .B \%has_key
530 returns
531 .B TRUE
532 or
533 .BR FALSE "."
534 .SH NOTES
535 .BR \%getch ","
536 .BR \%mvgetch ","
537 and
538 .B \%mvwgetch
539 may be implemented as macros.
540 .PP
541 .I curses
542 discourages assignment of the ESC key to a discrete function by the
543 programmer because the library requires a delay while it awaits the
544 potential remainder of a terminal escape sequence.
545 .PP
546 Some key strokes are indistinguishable from control characters;
547 for example,
548 .B \%KEY_ENTER
549 may be the same as
550 .BR \*^M ","
551 .\" as with att630 or pccon+keys
552 and
553 .B \%KEY_BACKSPACE
554 may be the same as
555 .B \*^H
556 .\" as with att505 or vt52-basic
557 or
558 .BR \*^? "."
559 .\" as with pccon+keys or vt320
560 Consult the
561 .I \%term\%info
562 entry for the terminal type to determine whether this is the case;
563 see \fB\%infocmp\fP(1).
564 Some
565 .I curses
566 implementations,
567 including
568 .IR \%ncurses ","
569 honor the
570 .I \%term\%info
571 key definitions;
572 others treat such control characters specially.
573 .PP
574 .I curses
575 distinguishes the Enter keys in the alphabetic and numeric keypad
576 sections of a keyboard because (most) terminals do.
577 .B \%KEY_ENTER
578 refers to the key on the numeric keypad and,
579 like other function keys,
580 is reliably recognized only if the window's keypad mode is enabled.
581 .bP
582 The
583 .I \%term\%info
584 .B \%key_enter
585 .RB ( kent )
586 capability describes the character (sequence) sent by the Enter key of
587 a terminal's numeric
588 (or similar)
589 keypad.
590 .bP
591 \*(``Enter or send\*('' is X/Open Curses's description of this key.
592 .PP
593 .I curses
594 treats the Enter or Return key in the
595 .I alphabetic
596 section of the keyboard differently.
597 .bP
598 It usually produces a control code for carriage return
599 .RB ( \*^M )
600 or line feed
601 .RB ( \*^J ).
602 .bP
603 Depending on the terminal mode
604 (raw,
605 cbreak,
606 or
607 canonical),
608 and whether \fB\%nl\fP(3NCURSES) or \fB\%nonl\fP(3NCURSES) has been called,
609 .B \%wgetch
610 may return either a carriage return or line feed upon an Enter or Return
611 key stroke.
612 .PP
613 Use of
614 .B \%wgetch
615 with \fB\%echo\fP(3NCURSES) and neither \fB\%cbreak\fP(3NCURSES) nor \fB\%raw\fP(3NCURSES)
616 is not well-defined.
617 .PP
618 Historically,
619 the list of key code macros above was influenced by the keyboard of the
620 AT&T 7300
621 (also known variously as the \*(``3B1\*('', \*(``Safari 4\*('', and
622 \*(``UNIX PC\*(''),
623 a 1985 machine rich in function keys.
624 Today's computer keyboards are based on that of the IBM PC/AT
625 and tend to have fewer.
626 A
627 .I curses
628 application can expect such a keyboard to transmit key codes
629 .BR \%KEY_UP ","
630 .BR \%KEY_DOWN ","
631 .BR \%KEY_LEFT ","
632 .BR \%KEY_RIGHT ","
633 .BR \%KEY_HOME ","
634 .BR \%KEY_END ","
635 .B \%KEY_PPAGE
636 (Page Up),
637 .B \%KEY_NPAGE
638 (Page Down),
639 .B \%KEY_IC
640 (Insert),
641 .B \%KEY_DC
642 (Delete),
643 .BR \%KEY_A1 ","
644 .BR \%KEY_A3 ","
645 .BR \%KEY_B2 ","
646 .BR \%KEY_C1 ","
647 .BR \%KEY_C3 ","
648 and
649 .BI \%KEY_F( n )
650 for 1 \(<=
651 .I n
652 \(<= 12.
653 .\" Other numeric keypad keys from the DEC VT220 (specifically, the
654 .\" LK201 commonly used with it) and IBM PC/AT keyboards -- the comma
655 .\" (DEC); plus, star, and slash (PC); and zero, dot, and minus (both)
656 .\" have no standard key capability codes.
657 .SH EXTENSIONS
658 In
659 .IR \%ncurses ","
660 when a window's \*(``no time-out\*('' mode is
661 .I not
662 set,
663 the
664 .B \%ESCDELAY
665 variable configures the duration of the timer used to disambiguate a
666 function key character sequence from a series of key strokes beginning
667 with ESC typed by the user;
668 see
669 \fB\%curses_variables\fP(3NCURSES).
670 .PP
671 .B \%has_key
672 is an
673 .I \%ncurses
674 extension,
675 and is not found in SVr4
676 .IR curses ","
677 4.4BSD
678 .IR curses ","
679 or any other previous
680 .I curses
681 implementation.
682 .SH PORTABILITY
683 Applications employing
684 .I \%ncurses
685 extensions should condition their use on the visibility of the
686 .B \%NCURSES_VERSION
687 preprocessor macro.
688 .PP
689 Except as noted in section \*(``EXTENSIONS\*('' above,
690 X/Open Curses Issue\ 4 describes these functions.
691 It specifies no error conditions for them.
692 .PP
693 SVr4 describes a successful return value only as
694 \*(``an integer value other than
695 .IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 494
696 .PP
697 .I \%wgetch
698 reads only single-byte characters.
699 .PP
700 The echo behavior of these functions on input of
701 .I KEY_
702 or backspace characters is not documented in SVr4
703 .IR curses "."
704 .PP
705 The behavior of
706 .I \%wgetch
707 in the presence of signal handlers is not documented in SVr4
708 .I curses
709 and is unspecified by X/Open Curses.
710 In historical
711 .I curses
712 implementations,
713 it varied depending on whether the operating system's dispatch of a
714 signal to a handler interrupted a \fIread\fP(2) call in progress,
715 and also
716 (in some implementations)
717 whether an input timeout or non-blocking mode had been set.
718 A portable
719 .I curses
720 application prepares for two cases:
721 (a) signal receipt does not interrupt
722 .IR \%wgetch ";"
723 or
724 (b) signal receipt interrupts
725 .I \%wgetch
726 and causes it to return
727 .I ERR
728 with
729 .I \%errno
730 set to
731 .IR \%EINTR "."
732 .PP
733 .I \%KEY_MOUSE
734 is mentioned in X/Open Curses,
735 along with a few related
736 .I \%term\%info
737 capabilities,
738 but no higher-level functions use the feature.
739 The implementation in
740 .I \%ncurses
741 is an extension.
742 .PP
743 .I \%KEY_RESIZE
744 and
745 .I \%has_key
746 are extensions first implemented for
747 .IR \%ncurses "."
748 By 2022,
749 .I \%PDCurses
750 .\" https://web.archive.org/web/20220117232009/https://pdcurses.org/docs/MANUAL.html
751 and
752 NetBSD
753 .I curses
754 .\" https://web.archive.org/web/20200923185647/https://man.netbsd.org/curses_input.3
755 had added them along with
756 .IR \%KEY_MOUSE "."
757 .SH HISTORY
758 4BSD (1980)
759 introduced
760 .I \%wgetch
761 and its variants.
762 .PP
763 SVr3 (1987)
764 added
765 .IR \%ungetch "."
766 .PP
767 .I \%ncurses
768 1.9.9g (1996)
769 furnished the
770 .I \%has_key
771 extension.
772 .SH SEE ALSO
773 ECMA-6 \*(``7-bit coded Character Set\*(''
774 \%<https://\*:ecma\-international\*:.org/\
775 \*:publications\-and\-standards/\*:standards/\*:ecma\-6/>
776 .PP
777 ECMA-48 \*(``Control Functions for Coded Character Sets\*(''
778 \%<https://\*:ecma\-international\*:.org/\
779 \*:publications\-and\-standards/\*:standards/\*:ecma\-48/>
780 .PP
781 \fB\%get_wch\fP(3NCURSES) describes comparable functions of the
782 .I \%ncurses
783 library in its wide-character configuration
784 .RI \%( ncursesw ).
785 .PP
786 \fB\%ncurses\fP(3NCURSES),
787 \fB\%addch\fP(3NCURSES),
788 \fB\%inopts\fP(3NCURSES),
789 \fB\%mouse\fP(3NCURSES),
790 \fB\%move\fP(3NCURSES),
791 \fB\%outopts\fP(3NCURSES),
792 \fB\%refresh\fP(3NCURSES),
793 \fB\%curses_variables\fP(3NCURSES),
794 \fB\%resizeterm\fP(3NCURSES),
795 \fB\%ascii\fP(7)