1TERMKEY_STRPKEY(3)         Library Functions Manual         TERMKEY_STRPKEY(3)
2
3
4

NAME

6       termkey_strpkey - parse a string representing a key event
7

SYNOPSIS

9       #include <termkey.h>
10
11       char *termkey_strpkey(TermKey *tk, const char *str,
12                   TermKeyKey *key, TermKeyFormat format);
13
14       Link with -ltermkey.
15

DESCRIPTION

17       termkey_strpkey(3)  parses  a string buffer containing a human-readable
18       representation of a key event. It fills the key structure from the  re‐
19       sults  of  this  parsing,  similar  to the strptime(3) standard library
20       function.
21
22       The format argument specifies the format expected in the string,  as  a
23       bitmask of the following constants:
24
25       TERMKEY_FORMAT_LONGMOD
26              Expect full modifier names e.g. "Shift-" instead of abbreviating
27              to "S-".
28
29       TERMKEY_FORMAT_CARETCTRL
30              If the only modifier is TERMKEY_MOD_CTRL on a plain letter,  ac‐
31              cept it as "^X" rather than "Ctrl-X".
32
33       TERMKEY_FORMAT_ALTISMETA
34              Expect  the  name  "Meta"  or the letter "M" instead of "Alt" or
35              "A".
36
37       TERMKEY_FORMAT_SPACEMOD
38              Expect spaces  instead  of  hyphens  to  separate  the  modifier
39              name(s) from the base key name.
40
41       TERMKEY_FORMAT_LOWERMOD
42              Expect lowercase for the modifier name.
43
44       TERMKEY_FORMAT_LOWERSPACE
45              Expect  lowercase  with  spaces  in  for the key name instead of
46              camelCase (for example "page down" instead of "PageDown").
47
48       TERMKEY_FORMAT_MOUSE_POS
49              Expect a mouse event to be followed by its position rendered  as
50              "@ (col,line)".
51
52       Before returning, this function canonicalises the key structure accord‐
53       ing to the rules given for termkey_canonicalise(3).
54
55       The TERMKEY_FORMAT_WRAPBRACKET option is  currently  not  supported  by
56       termkey_strpkey(). When returning a TERMKEY_TYPE_UNICODE key structure,
57       this function will fill in the utf8 member.
58

RETURN VALUE

60       After a successful parse, termkey_strpkey() returns a  pointer  to  the
61       first  character  of  the input it did not consume. If the input string
62       contains more characters then this will point at  the  first  character
63       beyond.  If  the entire input string was consumed, then this will point
64       at a null byte. If termkey_strpkey() fails to parse, it  returns  NULL.
65       After  a failed parse, the key structure may contain partial or invalid
66       results. The structure will only be valid if  the  function  returns  a
67       non-NULL result.
68

SEE ALSO

70       termkey_new(3), termkey_strfkey(3), termkey_keycmp(3), termkey(7)
71
72
73
74                                                            TERMKEY_STRPKEY(3)
Impressum