GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
TERMKEY_STRFKEY(3) FreeBSD Library Functions Manual TERMKEY_STRFKEY(3)

termkey_strfkey - format a string representing a key event

#include <termkey.h>

size_t termkey_strfkey(TermKey *tk, char *buffer, size_t len,
            TermKeyKey *key, TermKeyFormat format);

Link with -ltermkey.

termkey_strfkey() formats a string buffer to contain a human-readable representation of a key event. It fills the buffer in a way analogous to the snprintf(3) or strftime(3) standard library functions. This function used to be called termkey_snprint_key() but was renamed after version 0.6.

The format argument specifies the format of the output, as a bitmask of the following constants:

Print full modifier names e.g. "Shift-" instead of abbreviating to "S-".
If the only modifier is TERMKEY_MOD_CTRL on a plain letter, render it as "^X" rather than "Ctrl-X".
Use the name "Meta" or the letter "M" instead of "Alt" or "A".
If the key event is a special key instead of unmodified Unicode, wrap it in "<brackets>".
Use spaces instead of hyphens to separate the modifier name(s) from the base key name.
Use lowercase for the modifier name.
Use lowercase with spaces in for the key name instead of camelCase (for example "page down" instead of "PageDown").
If the event is a mouse event, include the position rendered as "@ (col,line)".

The following shortcuts are provided for common combinations of format bits:

Shortcut to set ALTISMETA and WRAPBRACKET, to give an output close to the format the vim editor uses.
Shortcut to set ALTISMETA, LONGMOD, LOWERMOD, SPACEMOD and LOWERSPACE, to give an output close to the format the urwid python library uses.

When formatting a TERMKEY_TYPE_UNICODE key structure, this function uses the utf8 member. If this member contains an empty string (i.e. its first character is 0) then this member will be prefilled by the function from the code.number member. This can be convenient when the key structure is being constructed programmatically by user code.

termkey_strfkey() returns the number of characters written to buffer.

termkey_new(3), termkey_getkey(3), termkey_waitkey(3), termkey_get_keyname(3), termkey_strpkey(3), termkey(7)


Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.