xref: /netbsd-src/lib/libcurses/curses_input.3 (revision 43b427685529f8e82b4e5ab65e20f8cd631efa11)
1*43b42768Suwe.\"	$NetBSD: curses_input.3,v 1.32 2024/05/14 10:40:41 uwe Exp $
223b2be97Sblymn.\"
323b2be97Sblymn.\" Copyright (c) 2002
4104b35feSgrant.\"	Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au)
523b2be97Sblymn.\"
623b2be97Sblymn.\" This code is donated to the NetBSD Foundation by the Author.
723b2be97Sblymn.\"
823b2be97Sblymn.\" Redistribution and use in source and binary forms, with or without
923b2be97Sblymn.\" modification, are permitted provided that the following conditions
1023b2be97Sblymn.\" are met:
1123b2be97Sblymn.\" 1. Redistributions of source code must retain the above copyright
1223b2be97Sblymn.\"    notice, this list of conditions and the following disclaimer.
1323b2be97Sblymn.\" 2. Redistributions in binary form must reproduce the above copyright
1423b2be97Sblymn.\"    notice, this list of conditions and the following disclaimer in the
1523b2be97Sblymn.\"    documentation and/or other materials provided with the distribution.
1623b2be97Sblymn.\" 3. The name of the Author may not be used to endorse or promote
1723b2be97Sblymn.\"    products derived from this software without specific prior written
1823b2be97Sblymn.\"    permission.
1923b2be97Sblymn.\"
2023b2be97Sblymn.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
2123b2be97Sblymn.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2223b2be97Sblymn.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2323b2be97Sblymn.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
2423b2be97Sblymn.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2523b2be97Sblymn.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2623b2be97Sblymn.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2723b2be97Sblymn.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2823b2be97Sblymn.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2923b2be97Sblymn.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3023b2be97Sblymn.\" SUCH DAMAGE.
3123b2be97Sblymn.\"
3223b2be97Sblymn.\"
33*43b42768Suwe.Dd May 14, 2024
3423b2be97Sblymn.Dt CURSES_INPUT 3
3523b2be97Sblymn.Os
3623b2be97Sblymn.Sh NAME
3723b2be97Sblymn.Nm curses_input ,
3823b2be97Sblymn.Nm getch ,
3923b2be97Sblymn.Nm wgetch ,
4034e5b046Sjdc.Nm mvgetch ,
4134e5b046Sjdc.Nm mvwgetch ,
425aec620aSblymn.Nm define_key ,
435aec620aSblymn.Nm keyok ,
446de5f0d1Sroy.Nm has_key ,
4523b2be97Sblymn.Nm getnstr ,
4623b2be97Sblymn.Nm wgetnstr ,
4723b2be97Sblymn.Nm mvgetnstr ,
4823b2be97Sblymn.Nm mvwgetnstr ,
4923b2be97Sblymn.Nm getstr ,
5023b2be97Sblymn.Nm wgetstr ,
5123b2be97Sblymn.Nm mvgetstr ,
5223b2be97Sblymn.Nm mvwgetstr ,
5323b2be97Sblymn.Nm keypad ,
54506f84ecSroy.Nm is_keypad ,
5523b2be97Sblymn.Nm notimeout ,
5623b2be97Sblymn.Nm timeout ,
5723b2be97Sblymn.Nm wtimeout ,
5823b2be97Sblymn.Nm nodelay ,
5947cc2fc3Sroy.Nm ungetch ,
6047cc2fc3Sroy.Nm set_escdelay
6123b2be97Sblymn.Nd curses input stream routines
6223b2be97Sblymn.Sh LIBRARY
6323b2be97Sblymn.Lb libcurses
6423b2be97Sblymn.Sh SYNOPSIS
65472351e1Swiz.In curses.h
6623b2be97Sblymn.Ft int
6723b2be97Sblymn.Fn getch "void"
6823b2be97Sblymn.Ft int
6923b2be97Sblymn.Fn wgetch "WINDOW *win"
7023b2be97Sblymn.Ft int
7198a0fd8dSyamt.Fn mvgetch "int y" "int x"
7234e5b046Sjdc.Ft int
7334e5b046Sjdc.Fn mvwgetch "WINDOW *win" "int y" "int x"
7434e5b046Sjdc.Ft int
755aec620aSblymn.Fn keyok "int key_symbol" "bool flag"
765aec620aSblymn.Ft int
776de5f0d1Sroy.Fn has_key "int key_symbol"
786de5f0d1Sroy.Ft int
7997b9891fSuwe.Fn define_key "const char *sequence" "int key_symbol"
805aec620aSblymn.Ft int
8123b2be97Sblymn.Fn getnstr "char *str" "int limit"
8223b2be97Sblymn.Ft int
8323b2be97Sblymn.Fn wgetnstr "WINDOW *win" "char *str" "int limit"
8423b2be97Sblymn.Ft int
8523b2be97Sblymn.Fn mvgetnstr "int y" "int x" "char *str" "int limit"
8623b2be97Sblymn.Ft int
8723b2be97Sblymn.Fn mvwgetnstr "WINDOW *win" "int y" "int x" "char *str" "int limit"
8823b2be97Sblymn.Ft int
8923b2be97Sblymn.Fn getstr "char *str"
9023b2be97Sblymn.Ft int
9123b2be97Sblymn.Fn wgetstr "WINDOW *win" "char *str"
9223b2be97Sblymn.Ft int
936f0dbbbfSwiz.Fn mvgetstr "int y" "int x" "char *str"
9423b2be97Sblymn.Ft int
956f0dbbbfSwiz.Fn mvwgetstr "WINDOW *win" "int y" "int x" "char *str"
9623b2be97Sblymn.Ft int
9784c538f9Srillig.Fn keypad "WINDOW *win" "bool flag"
98506f84ecSroy.Ft bool
99506f84ecSroy.Fn is_keypad "const WINDOW *win"
10023b2be97Sblymn.Ft int
10184c538f9Srillig.Fn notimeout "WINDOW *win" "bool flag"
10254e1935bScharlotte.Ft void
10323b2be97Sblymn.Fn timeout "int delay"
10482b5ace3Suwe.Ft void
10523b2be97Sblymn.Fn wtimeout "WINDOW *win" "int delay"
10623b2be97Sblymn.Ft int
10784c538f9Srillig.Fn nodelay "WINDOW *win" "bool flag"
10823b2be97Sblymn.Ft int
10923b2be97Sblymn.Fn ungetch "int c"
11047cc2fc3Sroy.Ft int
11147cc2fc3Sroy.Fn set_escdelay "int escdelay"
1120361a50aSjdc.Pp
11394f29563Swiz.Va extern int ESCDELAY ;
11423b2be97Sblymn.Sh DESCRIPTION
11523b2be97SblymnThese functions read characters and strings from the window input file
11623b2be97Sblymndescriptor.
11723b2be97Sblymn.Pp
11823b2be97SblymnThe
11923b2be97Sblymn.Fn getch
12023b2be97Sblymnfunction reads a character from the
12123b2be97Sblymn.Dv stdscr
12223b2be97Sblymninput file descriptor and returns it.
12323b2be97SblymnIf the
12423b2be97Sblymn.Fn keypad
12523b2be97Sblymnflag has been set to
12623b2be97Sblymn.Dv TRUE ,
12723b2be97Sblymnthen
12823b2be97Sblymn.Fn getch
12923b2be97Sblymnwill assemble multi-character key sequences into key symbols,
130efc30049SjdcIf the terminal is resized,
131efc30049Sjdc.Fn getch
132efc30049Sjdcwill return
133efc30049Sjdc.Dv KEY_RESIZE ,
134de3d24d6Sdhollandregardless of the setting of
135efc30049Sjdc.Fn keypad .
13623b2be97SblymnCalling
13723b2be97Sblymn.Fn getch
13823b2be97Sblymnwill cause an implicit
13923b2be97Sblymn.Fn refresh
14023b2be97Sblymnon
14123b2be97Sblymn.Dv stdscr .
14223b2be97Sblymn.Pp
14323b2be97SblymnThe
14423b2be97Sblymn.Fn wgetch
14523b2be97Sblymnfunction is the same as the
14623b2be97Sblymn.Fn getch
147efc30049Sjdcfunction, excepting that it reads from the input file descriptor associated
14823b2be97Sblymnwith the window specified by
14923b2be97Sblymn.Fa win .
15023b2be97Sblymn.Pp
1515aec620aSblymnIf the
1525aec620aSblymn.Fn keypad
1535aec620aSblymnflag is
1545aec620aSblymn.Dv TRUE
1555aec620aSblymnthen the assembly of specific key symbols can be disabled by using the
1565aec620aSblymn.Fn keyok
1575aec620aSblymnfunction.
1585aec620aSblymnIf the
1595aec620aSblymn.Fa flag
1605aec620aSblymnis set to
1615aec620aSblymn.Dv FALSE
1625aec620aSblymnon a key symbol then
1635aec620aSblymn.Fn getch
1645aec620aSblymnwill behave as if the character sequence associated with that key symbol
1655aec620aSblymnwas not recognised and will return the component characters one at a time to
1665aec620aSblymnthe caller.
167506f84ecSroyThe
168506f84ecSroy.Fn is_keypad
169506f84ecSroyfunction returns
170506f84ecSroy.Dv TRUE
171506f84ecSroyif the
172506f84ecSroy.Fn
173506f84ecSroykeypad
174506f84ecSroyflag is set for the window specified by
175506f84ecSroy.Fa win .
1765aec620aSblymn.Pp
1776de5f0d1SroyThe
1786de5f0d1Sroy.Fn has_key
1796de5f0d1Sroyfunction takes a key value and returns
1806de5f0d1Sroy.Dv TRUE
1816de5f0d1Sroyif the current terminal recognises a key with that value, otherwise
1826de5f0d1Sroy.Dv FALSE .
1836de5f0d1Sroy.Pp
1845aec620aSblymnCustom associations between sequences of characters and a key symbol can
1855aec620aSblymnbe made by using the
1865aec620aSblymn.Fn define_key
1875aec620aSblymnfunction.
1885aec620aSblymnNormally, these associations are made by the information in the
189258cf0abSroy.Xr terminfo 5
1905aec620aSblymndatabase but the
1915aec620aSblymn.Fn define_key
1925aec620aSblymnfunction gives the capability to remove or add more associations.
1935aec620aSblymnIf
1945aec620aSblymn.Fn define_key
1955aec620aSblymnis passed a non-NULL string in
1965aec620aSblymn.Fa sequence
1975aec620aSblymnit will associate that sequence with the key symbol passed in
1985aec620aSblymn.Fa key_symbol .
1995aec620aSblymnThe key symbol may be one of the ones listed below or a custom value that
2005aec620aSblymnis application defined.
2015aec620aSblymnIt is valid to have multiple character sequences map to the same key
2025aec620aSblymnsymbol and there are no constraints on the length of the sequence allowed.
2035aec620aSblymnThe assembly of custom sequences follow the same rules for inter-character
2045aec620aSblymntiming and so forth as the
205258cf0abSroy.Xr terminfo 5
2065aec620aSblymnderived ones.
2075aec620aSblymnIf
2085aec620aSblymn.Fn define_key
2095aec620aSblymnis passed a NULL in
2105aec620aSblymn.Fa sequence
2115aec620aSblymnthen all associations for the key symbol in
2125aec620aSblymn.Fa key_symbol
2135aec620aSblymnwill be deleted, this includes any associations that were derived from
214258cf0abSroy.Xr terminfo 5 .
2155aec620aSblymn.Pp
21623b2be97SblymnThe
21723b2be97Sblymn.Fn mvgetch
21823b2be97Sblymnand
21923b2be97Sblymn.Fn mvwgetch
22023b2be97Sblymnfunctions are the same as the
22123b2be97Sblymn.Fn getch
22223b2be97Sblymnand
22323b2be97Sblymn.Fn wgetch
22423b2be97Sblymnfunctions, respectively, excepting that
22523b2be97Sblymn.Fn wmove
22623b2be97Sblymnis called to move the cursor to the position specified by
22723b2be97Sblymn.Fa y ,
22823b2be97Sblymn.Fa x
22923b2be97Sblymnbefore the character is read.
23023b2be97Sblymn.Pp
23123b2be97SblymnCalling
23223b2be97Sblymn.Fn getnstr ,
23323b2be97Sblymn.Fn wgetnstr ,
23423b2be97Sblymn.Fn mvgetnstr
23523b2be97Sblymnor
23623b2be97Sblymn.Fn mvwgetnstr
23723b2be97Sblymnis effectively the same as calling
23823b2be97Sblymn.Fn getch
23923b2be97Sblymnrepeatedly until a newline is received or the character limit
24023b2be97Sblymn.Fa limit
24123b2be97Sblymnis reached.
24223b2be97SblymnOnce this happens the string is
24323b2be97Sblymn.Dv NULL
24423b2be97Sblymnterminated and returned in
24523b2be97Sblymn.Fa str .
24623b2be97SblymnDuring input, the normal curses input key processing is performed and
24723b2be97Sblymnaffects the input buffer.
24823b2be97SblymnThe
24923b2be97Sblymn.Fn mvgetnstr
25023b2be97Sblymnfunction calls
25123b2be97Sblymn.Fn wmove
25223b2be97Sblymnto move the cursor to the position given by
25323b2be97Sblymn.Fa y ,
25423b2be97Sblymn.Fa x
25523b2be97Sblymnbefore getting the string,
25623b2be97Sblymn.Fn wgetnstr
25723b2be97Sblymnreads the input from the designated window,
25823b2be97Sblymn.Fn mvwgetnstr
25923b2be97Sblymnmoves the cursor to the position given by
26023b2be97Sblymn.Fa y ,
26123b2be97Sblymn.Fa x
26223b2be97Sblymnbefore getting the input from the designated window.
26323b2be97Sblymn.Pp
26423b2be97SblymnThe functions
26523b2be97Sblymn.Fn getstr ,
26623b2be97Sblymn.Fn wgetstr ,
267359ed995Swiz.Fn mvgetstr ,
26823b2be97Sblymnand
26923b2be97Sblymn.Fn mvwgetstr
27023b2be97Sblymnare similar to
27123b2be97Sblymn.Fn getnstr ,
27223b2be97Sblymn.Fn wgetnstr ,
273359ed995Swiz.Fn mvgetnstr ,
27423b2be97Sblymnand
27523b2be97Sblymn.Fn mvwgetnstr ,
27623b2be97Sblymnrespectively, excepting that there is no limit on the number of characters
27723b2be97Sblymnthat may be inserted into
27823b2be97Sblymn.Fa str .
27923b2be97SblymnThis may cause the buffer to be overflowed, so their use is not recommended.
28023b2be97Sblymn.Pp
28123b2be97SblymnThe
28223b2be97Sblymn.Fn keypad
28323b2be97Sblymnfunction is used to affect how
28423b2be97Sblymn.Fn getch
28523b2be97Sblymnprocesses input characters.
28623b2be97SblymnIf
28723b2be97Sblymn.Fa flag
28823b2be97Sblymnis set to
28923b2be97Sblymn.Dv TRUE ,
29023b2be97Sblymnthen
29123b2be97Sblymn.Fn getch
29223b2be97Sblymnwill scan the input stream looking for multi-character key sequences
29323b2be97Sblymnthat are emitted by some terminal function keys.
29423b2be97SblymnIf a recognised sequence of characters is found, then
29523b2be97Sblymn.Fn getch
29623b2be97Sblymnwill collapse that sequence into an integer key symbol, as shown below.
29723b2be97SblymnThe default setting for the flag is
29823b2be97Sblymn.Dv FALSE .
29923b2be97Sblymn.Pp
30023b2be97SblymnThe
30123b2be97Sblymn.Fn notimeout
30223b2be97Sblymnfunction controls whether or not
30323b2be97Sblymn.Fn getch
30423b2be97Sblymnwill wait indefinitely between characters in a multi-character key
30523b2be97Sblymnsequence or not.
30623b2be97SblymnIf
30723b2be97Sblymn.Fa flag
30823b2be97Sblymnis
30923b2be97Sblymn.Dv TRUE ,
31023b2be97Sblymnthen there is no timeout applied between characters comprising a
31123b2be97Sblymnmulti-character key sequence.
31223b2be97SblymnIf
31323b2be97Sblymn.Fa flag
31423b2be97Sblymnis
31523b2be97Sblymn.Dv FALSE ,
31623b2be97Sblymnthen the component characters of a multi-character sequence must not
3177a37df1bSjdchave an inter-character gap of more than
31894f29563Swiz.Va ESCDELAY .
31923b2be97SblymnIf this timing is exceeded, then the multi-character key assembly is
32023b2be97Sblymndeemed to have failed and the characters read thus far are returned
32123b2be97Sblymnone at a time when
32223b2be97Sblymn.Fn getch
32323b2be97Sblymnis called.
32423b2be97SblymnThe default setting for the flag is
32523b2be97Sblymn.Dv FALSE .
3267a37df1bSjdcThe default value of
32794f29563Swiz.Va ESCDELAY
32894f29563Swizis 300ms.
32994f29563SwizIf
33094f29563Swiz.Va ESCDELAY
33194f29563Swizis negative, no timeout is applied between characters comprising a
3327a37df1bSjdcmulti-character key sequence.
33323b2be97Sblymn.Pp
33423b2be97SblymnThe
33523b2be97Sblymn.Fn timeout
33623b2be97Sblymnfunction affects the behaviour of
33723b2be97Sblymn.Fn getch
33823b2be97Sblymnwhen reading a character from
33923b2be97Sblymn.Dv stdscr .
34023b2be97SblymnIf
34123b2be97Sblymn.Fa delay
34223b2be97Sblymnis negative, then
34323b2be97Sblymn.Fn getch
34423b2be97Sblymnwill block indefinitely on a read.
34523b2be97SblymnIf
34623b2be97Sblymn.Fa delay
34723b2be97Sblymnis 0, then
34823b2be97Sblymn.Fn getch
34923b2be97Sblymnwill return immediately with
35023b2be97Sblymn.Dv ERR
35123b2be97Sblymnif there are no characters immediately available.
35223b2be97SblymnIf
35323b2be97Sblymn.Fa delay
35423b2be97Sblymnis a positive number, then
35523b2be97Sblymn.Fn getch
35623b2be97Sblymnwill wait for that many milliseconds before returning and, if no character
35723b2be97Sblymnwas available, then
35823b2be97Sblymn.Dv ERR
35923b2be97Sblymnwill be returned.
36023b2be97SblymnNote that for a positive number, the timeout is only accurate to the nearest
36123b2be97Sblymntenth of a second.
362ad66eb82SchristosAlso, the maximum value of
363ad66eb82Schristos.Fa delay
364ad66eb82Schristosis 25500 milliseconds.
36523b2be97SblymnThe
36623b2be97Sblymn.Fn wtimeout
36723b2be97Sblymnfunction does the same as
36823b2be97Sblymn.Fn timeout
36923b2be97Sblymnbut applies to the specified window
37023b2be97Sblymn.Fa win .
37123b2be97Sblymn.Pp
37223b2be97SblymnThe
37323b2be97Sblymn.Fn nodelay
37423b2be97Sblymnfunction turns on and off blocking reads for
37523b2be97Sblymn.Fn getch .
37623b2be97SblymnIf
37723b2be97Sblymn.Fa flag
37823b2be97Sblymnis
37923b2be97Sblymn.Dv TRUE ,
38023b2be97Sblymnthen
38123b2be97Sblymn.Fn getch
38223b2be97Sblymnwill not block on reads, if
38323b2be97Sblymn.Fa flag
38423b2be97Sblymnis
38523b2be97Sblymn.Dv FALSE ,
38623b2be97Sblymnthen reads will block.
38723b2be97SblymnThe default setting for the flag is
38823b2be97Sblymn.Dv FALSE .
38923b2be97Sblymn.Fn nodelay win TRUE
39023b2be97Sblymnis equivalent to
39123b2be97Sblymn.Fn wtimeout win 0
39223b2be97Sblymnand
39323b2be97Sblymn.Fn nodelay win FALSE
39423b2be97Sblymnis equivalent to
395a2e19aabSwiz.Fn wtimeout win \-1 .
39623b2be97Sblymn.Pp
39723b2be97Sblymn.Fn ungetch
39823b2be97Sblymnwill convert
39923b2be97Sblymn.Fa c
40023b2be97Sblymninto an unsigned char and push that character back onto the input stream.
40123b2be97SblymnOnly one character of push-back is guaranteed to work, more may be possible
40223b2be97Sblymndepending on system resources.
40347cc2fc3Sroy.Pp
40447cc2fc3SroyThe
40547cc2fc3Sroy.Fn set_escdelay
40647cc2fc3Sroyfunction sets the
40747cc2fc3Sroy.Va ESCDELAY
40847cc2fc3Sroyvalue of the current screen to
40947cc2fc3Sroy.Fa escdelay .
41023b2be97Sblymn.Sh RETURN VALUES
41134e5b046SjdcThe functions
41234e5b046Sjdc.Fn getch ,
41334e5b046Sjdc.Fn wgetch ,
414359ed995Swiz.Fn mvgetch ,
41534e5b046Sjdcand
41634e5b046Sjdc.Fn mvwgetch
41734e5b046Sjdcwill return the value of the key pressed or
41834e5b046Sjdc.Dv ERR
41934e5b046Sjdcin the case of an error or a timeout.
42034e5b046SjdcAdditionally, if
42123b2be97Sblymn.Fn keypad TRUE
422359ed995Swizhas been called on a window, then it may return one of the following values:
42323b2be97Sblymn.Pp
42423b2be97Sblymn.Bl -column "Termcap entry" "getch Return Value" "Key Function" -offset indent
42523b2be97Sblymn.It Sy "Termcap entry" Ta Sy "getch Return Value" Ta Sy "Key Function"
42623b2be97Sblymn.It \&!1 Ta KEY_SSAVE Ta Shift Save
42723b2be97Sblymn.It \&!2 Ta KEY_SSUSPEND Ta Shift Suspend
42823b2be97Sblymn.It \&!3 Ta KEY_SUNDO Ta Shift Undo
42923b2be97Sblymn.It \&#1 Ta KEY_SHELP Ta Shift Help
43023b2be97Sblymn.It \&#2 Ta KEY_SHOME Ta Shift Home
43123b2be97Sblymn.It \&#3 Ta KEY_SIC Ta Shift Insert Character
43223b2be97Sblymn.It \&#4 Ta KEY_SLEFT Ta Shift Left Arrow
43323b2be97Sblymn.It \&%0 Ta KEY_REDO Ta Redo
43423b2be97Sblymn.It \&%1 Ta KEY_HELP Ta Help
43523b2be97Sblymn.It \&%2 Ta KEY_MARK Ta Mark
43623b2be97Sblymn.It \&%3 Ta KEY_MESSAGE Ta Message
43723b2be97Sblymn.It \&%4 Ta KEY_MOVE Ta Move
43823b2be97Sblymn.It \&%5 Ta KEY_NEXT Ta Next Object
43923b2be97Sblymn.It \&%6 Ta KEY_OPEN Ta Open
44023b2be97Sblymn.It \&%7 Ta KEY_OPTIONS Ta Options
44123b2be97Sblymn.It \&%8 Ta KEY_PREVIOUS Ta Previous Object
44223b2be97Sblymn.It \&%9 Ta KEY_PRINT Ta Print
44323b2be97Sblymn.It \&%a Ta KEY_SMESSAGE Ta Shift Message
44423b2be97Sblymn.It \&%b Ta KEY_SMOVE Ta Shift Move
44523b2be97Sblymn.It \&%c Ta KEY_SNEXT Ta Shift Next Object
44623b2be97Sblymn.It \&%d Ta KEY_SOPTIONS Ta Shift Options
44723b2be97Sblymn.It \&%e Ta KEY_SPREVIOUS Ta Shift Previous Object
44823b2be97Sblymn.It \&%f Ta KEY_SPRINT Ta Shift Print
44923b2be97Sblymn.It \&%g Ta KEY_SREDO Ta Shift Redo
45023b2be97Sblymn.It \&%h Ta KEY_SREPLACE Ta Shift Replace
45123b2be97Sblymn.It \&%i Ta KEY_SRIGHT Ta Shift Right Arrow
45223b2be97Sblymn.It \&%j Ta KEY_SRSUME Ta Shift Resume
45301869ca4Swiz.It \&&0 Ta KEY_SCANCEL Ta Shift Cancel
45401869ca4Swiz.It \&&1 Ta KEY_REFERENCE Ta Reference
45501869ca4Swiz.It \&&2 Ta KEY_REFRESH Ta Refresh
45601869ca4Swiz.It \&&3 Ta KEY_REPLACE Ta Replace
45701869ca4Swiz.It \&&4 Ta KEY_RESTART Ta Restart
45801869ca4Swiz.It \&&5 Ta KEY_RESUME Ta Resume
45901869ca4Swiz.It \&&6 Ta KEY_SAVE Ta Save
46001869ca4Swiz.It \&&7 Ta KEY_SUSPEND Ta Suspend
46101869ca4Swiz.It \&&8 Ta KEY_UNDO Ta Undo
46201869ca4Swiz.It \&&9 Ta KEY_SBEG Ta Shift Begin
46323b2be97Sblymn.It \&*0 Ta KEY_SFIND Ta Shift Find
46423b2be97Sblymn.It \&*1 Ta KEY_SCOMMAND Ta Shift Command
46523b2be97Sblymn.It \&*2 Ta KEY_SCOPY Ta Shift Copy
46623b2be97Sblymn.It \&*3 Ta KEY_SCREATE Ta Shift Create
46723b2be97Sblymn.It \&*4 Ta KEY_SDC Ta Shift Delete Character
46823b2be97Sblymn.It \&*5 Ta KEY_SDL Ta Shift Delete Line
46923b2be97Sblymn.It \&*6 Ta KEY_SELECT Ta Select
47023b2be97Sblymn.It \&*7 Ta KEY_SEND Ta Shift End
47123b2be97Sblymn.It \&*8 Ta KEY_SEOL Ta Shift Clear to EOL
47223b2be97Sblymn.It \&*9 Ta KEY_SEXIT Ta Shift Exit
47323b2be97Sblymn.It \&@0 Ta KEY_FIND Ta Find
47423b2be97Sblymn.It \&@1 Ta KEY_BEG Ta Begin
47523b2be97Sblymn.It \&@2 Ta KEY_CANCEL Ta Cancel
47623b2be97Sblymn.It \&@3 Ta KEY_CLOSE Ta Close
47723b2be97Sblymn.It \&@4 Ta KEY_COMMAND Ta Command
47823b2be97Sblymn.It \&@5 Ta KEY_COPY Ta Copy
47923b2be97Sblymn.It \&@6 Ta KEY_CREATE Ta Create
48023b2be97Sblymn.It \&@7 Ta KEY_END Ta End
48123b2be97Sblymn.It \&@8 Ta KEY_ENTER Ta Enter
48223b2be97Sblymn.It \&@9 Ta KEY_EXIT Ta Exit
48323b2be97Sblymn.It \&F1 Ta KEY_F(11) Ta Function Key 11
48423b2be97Sblymn.It \&F2 Ta KEY_F(12) Ta Function Key 12
48523b2be97Sblymn.It \&F3 Ta KEY_F(13) Ta Function Key 13
48623b2be97Sblymn.It \&F4 Ta KEY_F(14) Ta Function Key 14
48723b2be97Sblymn.It \&F5 Ta KEY_F(15) Ta Function Key 15
48823b2be97Sblymn.It \&F6 Ta KEY_F(16) Ta Function Key 16
48923b2be97Sblymn.It \&F7 Ta KEY_F(17) Ta Function Key 17
49023b2be97Sblymn.It \&F8 Ta KEY_F(18) Ta Function Key 18
49123b2be97Sblymn.It \&F9 Ta KEY_F(19) Ta Function Key 19
49223b2be97Sblymn.It \&FA Ta KEY_F(20) Ta Function Key 20
49323b2be97Sblymn.It \&FB Ta KEY_F(21) Ta Function Key 21
49423b2be97Sblymn.It \&FC Ta KEY_F(22) Ta Function Key 22
49523b2be97Sblymn.It \&FD Ta KEY_F(23) Ta Function Key 23
49623b2be97Sblymn.It \&FE Ta KEY_F(24) Ta Function Key 24
49723b2be97Sblymn.It \&FF Ta KEY_F(25) Ta Function Key 25
49823b2be97Sblymn.It \&FG Ta KEY_F(26) Ta Function Key 26
49923b2be97Sblymn.It \&FH Ta KEY_F(27) Ta Function Key 27
50023b2be97Sblymn.It \&FI Ta KEY_F(28) Ta Function Key 28
50123b2be97Sblymn.It \&FJ Ta KEY_F(29) Ta Function Key 29
50223b2be97Sblymn.It \&FK Ta KEY_F(30) Ta Function Key 30
50323b2be97Sblymn.It \&FL Ta KEY_F(31) Ta Function Key 31
50423b2be97Sblymn.It \&FM Ta KEY_F(32) Ta Function Key 32
50523b2be97Sblymn.It \&FN Ta KEY_F(33) Ta Function Key 33
50623b2be97Sblymn.It \&FO Ta KEY_F(34) Ta Function Key 34
50723b2be97Sblymn.It \&FP Ta KEY_F(35) Ta Function Key 35
50823b2be97Sblymn.It \&FQ Ta KEY_F(36) Ta Function Key 36
50923b2be97Sblymn.It \&FR Ta KEY_F(37) Ta Function Key 37
51023b2be97Sblymn.It \&FS Ta KEY_F(38) Ta Function Key 38
51123b2be97Sblymn.It \&FT Ta KEY_F(39) Ta Function Key 39
51223b2be97Sblymn.It \&FU Ta KEY_F(40) Ta Function Key 40
51323b2be97Sblymn.It \&FV Ta KEY_F(41) Ta Function Key 41
51423b2be97Sblymn.It \&FW Ta KEY_F(42) Ta Function Key 42
51523b2be97Sblymn.It \&FX Ta KEY_F(43) Ta Function Key 43
51623b2be97Sblymn.It \&FY Ta KEY_F(44) Ta Function Key 44
51723b2be97Sblymn.It \&FZ Ta KEY_F(45) Ta Function Key 45
51823b2be97Sblymn.It \&Fa Ta KEY_F(46) Ta Function Key 46
51923b2be97Sblymn.It \&Fb Ta KEY_F(47) Ta Function Key 47
52023b2be97Sblymn.It \&Fc Ta KEY_F(48) Ta Function Key 48
52123b2be97Sblymn.It \&Fd Ta KEY_F(49) Ta Function Key 49
52223b2be97Sblymn.It \&Fe Ta KEY_F(50) Ta Function Key 50
52323b2be97Sblymn.It \&Ff Ta KEY_F(51) Ta Function Key 51
52423b2be97Sblymn.It \&Fg Ta KEY_F(52) Ta Function Key 52
52523b2be97Sblymn.It \&Fh Ta KEY_F(53) Ta Function Key 53
52623b2be97Sblymn.It \&Fi Ta KEY_F(54) Ta Function Key 54
52723b2be97Sblymn.It \&Fj Ta KEY_F(55) Ta Function Key 55
52823b2be97Sblymn.It \&Fk Ta KEY_F(56) Ta Function Key 56
52923b2be97Sblymn.It \&Fl Ta KEY_F(57) Ta Function Key 57
53023b2be97Sblymn.It \&Fm Ta KEY_F(58) Ta Function Key 58
53123b2be97Sblymn.It \&Fn Ta KEY_F(59) Ta Function Key 59
53223b2be97Sblymn.It \&Fo Ta KEY_F(60) Ta Function Key 60
53323b2be97Sblymn.It \&Fp Ta KEY_F(61) Ta Function Key 61
53423b2be97Sblymn.It \&Fq Ta KEY_F(62) Ta Function Key 62
53523b2be97Sblymn.It \&Fr Ta KEY_F(63) Ta Function Key 63
53623b2be97Sblymn.It \&K1 Ta KEY_A1 Ta Upper left key in keypad
53723b2be97Sblymn.It \&K2 Ta KEY_B2 Ta Centre key in keypad
53823b2be97Sblymn.It \&K3 Ta KEY_A3 Ta Upper right key in keypad
53923b2be97Sblymn.It \&K4 Ta KEY_C1 Ta Lower left key in keypad
54023b2be97Sblymn.It \&K5 Ta KEY_C3 Ta Lower right key in keypad
54123b2be97Sblymn.It \&Km Ta KEY_MOUSE Ta Mouse Event
54223b2be97Sblymn.It \&k0 Ta KEY_F0 Ta Function Key 0
54323b2be97Sblymn.It \&k1 Ta KEY_F(1) Ta Function Key 1
54423b2be97Sblymn.It \&k2 Ta KEY_F(2) Ta Function Key 2
54523b2be97Sblymn.It \&k3 Ta KEY_F(3) Ta Function Key 3
54623b2be97Sblymn.It \&k4 Ta KEY_F(4) Ta Function Key 4
54723b2be97Sblymn.It \&k5 Ta KEY_F(5) Ta Function Key 5
54823b2be97Sblymn.It \&k6 Ta KEY_F(6) Ta Function Key 6
54923b2be97Sblymn.It \&k7 Ta KEY_F(7) Ta Function Key 7
55023b2be97Sblymn.It \&k8 Ta KEY_F(8) Ta Function Key 8
55123b2be97Sblymn.It \&k9 Ta KEY_F(9) Ta Function Key 9
55223b2be97Sblymn.It \&k; Ta KEY_F(10) Ta Function Key 10
55323b2be97Sblymn.It \&kA Ta KEY_IL Ta Insert Line
55423b2be97Sblymn.It \&ka Ta KEY_CATAB Ta Clear All Tabs
55523b2be97Sblymn.It \&kB Ta KEY_BTAB Ta Back Tab
55623b2be97Sblymn.It \&kb Ta KEY_BACKSPACE Ta Backspace
55723b2be97Sblymn.It \&kC Ta KEY_CLEAR Ta Clear
55823b2be97Sblymn.It \&kD Ta KEY_DC Ta Delete Character
55923b2be97Sblymn.It \&kd Ta KEY_DOWN Ta Down Arrow
56023b2be97Sblymn.It \&kE Ta KEY_EOL Ta Clear to End Of Line
56123b2be97Sblymn.It \&kF Ta KEY_SF Ta Scroll Forward one line
56223b2be97Sblymn.It \&kH Ta KEY_LL Ta Home Down
56323b2be97Sblymn.It \&kh Ta KEY_HOME Ta Home
56423b2be97Sblymn.It \&kI Ta KEY_IC Ta Insert Character
56523b2be97Sblymn.It \&kL Ta KEY_DL Ta Delete Line
56623b2be97Sblymn.It \&kl Ta KEY_LEFT Ta Left Arrow
56723b2be97Sblymn.It \&kM Ta KEY_EIC Ta Exit Insert Character Mode
56823b2be97Sblymn.It \&kN Ta KEY_NPAGE Ta Next Page
56923b2be97Sblymn.It \&kP Ta KEY_PPAGE Ta Previous Page
57023b2be97Sblymn.It \&kR Ta KEY_SR Ta Scroll One Line Back
57123b2be97Sblymn.It \&kr Ta KEY_RIGHT Ta Right Arrow
57223b2be97Sblymn.It \&kS Ta KEY_EOS Ta Clear to End Of Screen
57323b2be97Sblymn.It \&kT Ta KEY_STAB Ta Set Tab
57423b2be97Sblymn.It \&kt Ta KEY_CTAB Ta Clear Tab
57523b2be97Sblymn.It \&ku Ta KEY_UP Ta Up Arrow
57623b2be97Sblymn.El
57723b2be97Sblymn.Pp
57823b2be97SblymnNote that not all terminals are capable of generating all the keycodes
579258cf0abSroylisted above nor are terminfo entries normally configured with all the
58023b2be97Sblymnabove capabilities defined.
58123b2be97Sblymn.Pp
58234e5b046SjdcOther functions that return an int will return one of the following
58323b2be97Sblymnvalues:
58423b2be97Sblymn.Pp
58523b2be97Sblymn.Bl -tag -width ERR -compact
58623b2be97Sblymn.It Er OK
58723b2be97SblymnThe function completed successfully.
58823b2be97Sblymn.It Er ERR
58923b2be97SblymnAn error occurred in the function.
59023b2be97Sblymn.El
59134e5b046Sjdc.Pp
59234e5b046SjdcFunctions returning pointers will return
59334e5b046Sjdc.Dv NULL
59434e5b046Sjdcif an error is detected.
59523b2be97Sblymn.Sh SEE ALSO
596c3d0728dSwiz.Xr curses_cursor 3 ,
597c521d02fSjdc.Xr curses_keyname 3 ,
59823b2be97Sblymn.Xr curses_refresh 3 ,
59923b2be97Sblymn.Xr curses_tty 3 ,
600258cf0abSroy.Xr terminfo 5
60123b2be97Sblymn.Sh STANDARDS
60223b2be97SblymnThe
60323b2be97Sblymn.Nx
60423b2be97SblymnCurses library complies with the X/Open Curses specification, part of the
60523b2be97SblymnSingle Unix Specification.
6065aec620aSblymn.Sh NOTES
6075aec620aSblymnThe
6085aec620aSblymn.Fn keyok
6095aec620aSblymnand
6105aec620aSblymn.Fn define_key
6115aec620aSblymnfunctions are implementations of extensions made by the NCurses library
6125aec620aSblymnto the Curses standard.
6135aec620aSblymnPortable implementations should avoid the use of these functions.
61423b2be97Sblymn.Sh HISTORY
61523b2be97SblymnThe Curses package appeared in
61623b2be97Sblymn.Bx 4.0 .
61747cc2fc3SroyThe
618506f84ecSroy.Fn is_keypad
619506f84ecSroyand
62047cc2fc3Sroy.Fn set_tabsize
621506f84ecSroyfunctions are
62247cc2fc3Sroy.Em ncurses
62347cc2fc3Sroyextension to the Curses library and was added in
62447cc2fc3Sroy.Nx 8.0 .
625