Keys: GNT Reference Manual

## Keys Keys — Key value lookup and transformation |

## Functions

#define | SAFE()
void | gnt_init_keys ()
void | gnt_keys_refine ()
const char * | gnt_key_translate ()
const char * | gnt_key_lookup ()
void | gnt_keys_add_combination ()
void | gnt_keys_del_combination ()
int | gnt_keys_find_combination ()

## Types and Values

extern char * | gnt_key_cup
extern char * | gnt_key_cdown
extern char * | gnt_key_cleft
extern char * | gnt_key_cright
#define | GNT_KEY_POPUP
#define | GNT_KEY_LEFT
#define | GNT_KEY_RIGHT
#define | GNT_KEY_UP
#define | GNT_KEY_DOWN
#define | GNT_KEY_CTRL_UP
#define | GNT_KEY_CTRL_DOWN
#define | GNT_KEY_CTRL_RIGHT
#define | GNT_KEY_CTRL_LEFT
#define | GNT_KEY_PGUP
#define | GNT_KEY_PGDOWN
#define | GNT_KEY_HOME
#define | GNT_KEY_END
#define | GNT_KEY_ENTER
#define | GNT_KEY_BACKSPACE
#define | GNT_KEY_DEL
#define | GNT_KEY_INS
#define | GNT_KEY_BACK_TAB
#define | GNT_KEY_CTRL_A
#define | GNT_KEY_CTRL_B
#define | GNT_KEY_CTRL_D
#define | GNT_KEY_CTRL_E
#define | GNT_KEY_CTRL_F
#define | GNT_KEY_CTRL_G
#define | GNT_KEY_CTRL_H
#define | GNT_KEY_CTRL_I
#define | GNT_KEY_CTRL_J
#define | GNT_KEY_CTRL_K
#define | GNT_KEY_CTRL_L
#define | GNT_KEY_CTRL_M
#define | GNT_KEY_CTRL_N
#define | GNT_KEY_CTRL_O
#define | GNT_KEY_CTRL_P
#define | GNT_KEY_CTRL_R
#define | GNT_KEY_CTRL_T
#define | GNT_KEY_CTRL_U
#define | GNT_KEY_CTRL_V
#define | GNT_KEY_CTRL_W
#define | GNT_KEY_CTRL_X
#define | GNT_KEY_CTRL_Y
#define | GNT_KEY_F1
#define | GNT_KEY_F2
#define | GNT_KEY_F3
#define | GNT_KEY_F4
#define | GNT_KEY_F5
#define | GNT_KEY_F6
#define | GNT_KEY_F7
#define | GNT_KEY_F8
#define | GNT_KEY_F9
#define | GNT_KEY_F10
#define | GNT_KEY_F11
#define | GNT_KEY_F12

## Description

## Functions

### SAFE()

    #define SAFE(x)   ((cur_term && (x)) ? (x) : "")

### gnt_init_keys ()

    void
    gnt_init_keys (void);

Initialize the keys.

### gnt_keys_refine ()

    void
    gnt_keys_refine (char *text);

Refine input text. This usually looks at what the terminal claims it is, and tries to change the text to work around some oft-broken terminfo entries.

#### Parameters

text | The input text to refine. |

### gnt_key_translate ()

    const char *
    gnt_key_translate (const char *name);

Translate a user-readable representation of an input to a machine-readable representation.

#### Parameters

name | The user-readable representation of an input (eg.: c-t) |

#### Returns

A machine-readable representation of the input.

### gnt_key_lookup ()

    const char *
    gnt_key_lookup (const char *key);

Translate a machine-readable representation of an input to a user-readable representation.

#### Parameters

key | The machine-readable representation of an input. |

#### Returns

A user-readable representation of the input (eg.: c-t).

### gnt_keys_add_combination ()

    void
    gnt_keys_add_combination (const char *key);

Add a key combination to the internal key-tree.

#### Parameters

key | The key to add |

### gnt_keys_del_combination ()

    void
    gnt_keys_del_combination (const char *key);

Remove a key combination from the internal key-tree.

#### Parameters

key | The key to remove. |

### gnt_keys_find_combination ()

    int
    gnt_keys_find_combination (const char *key);

Find a combination from the given string.

#### Parameters

key | The input string. |

#### Returns

The number of bytes in the combination that starts at the beginning of key (can be 0).

## Types and Values

### gnt_key_cup

    extern char *gnt_key_cup;

### gnt_key_cdown

    extern char *gnt_key_cdown;

### gnt_key_cleft

    extern char *gnt_key_cleft;

### gnt_key_cright

    extern char *gnt_key_cright;

### GNT_KEY_POPUP

    #define GNT_KEY_POPUP   SAFE(key_f16)   /* Apparently */

### GNT_KEY_LEFT

    #define GNT_KEY_LEFT   SAFE(key_left)

### GNT_KEY_RIGHT

    #define GNT_KEY_RIGHT  SAFE(key_right)

### GNT_KEY_UP

    #define GNT_KEY_UP     SAFE(key_up)

### GNT_KEY_DOWN

    #define GNT_KEY_DOWN   SAFE(key_down)

### GNT_KEY_CTRL_UP

    #define GNT_KEY_CTRL_UP     SAFE(gnt_key_cup)

### GNT_KEY_CTRL_DOWN

    #define GNT_KEY_CTRL_DOWN   SAFE(gnt_key_cdown)

### GNT_KEY_CTRL_RIGHT

    #define GNT_KEY_CTRL_RIGHT  SAFE(gnt_key_cright)

### GNT_KEY_CTRL_LEFT

    #define GNT_KEY_CTRL_LEFT   SAFE(gnt_key_cleft)

### GNT_KEY_PGUP

    #define GNT_KEY_PGUP   SAFE(key_ppage)

### GNT_KEY_PGDOWN

    #define GNT_KEY_PGDOWN SAFE(key_npage)

### GNT_KEY_HOME

    #define GNT_KEY_HOME   SAFE(key_home)

### GNT_KEY_END

    #define GNT_KEY_END    SAFE(key_end)

### GNT_KEY_ENTER

    #define GNT_KEY_ENTER  SAFE(carriage_return)

### GNT_KEY_BACKSPACE

    #define GNT_KEY_BACKSPACE SAFE(key_backspace)

### GNT_KEY_DEL

    #define GNT_KEY_DEL    SAFE(key_dc)

### GNT_KEY_INS

    #define GNT_KEY_INS    SAFE(key_ic)

### GNT_KEY_BACK_TAB

    #define GNT_KEY_BACK_TAB ((cur_term && back_tab) ? back_tab : SAFE(key_btab))

### GNT_KEY_CTRL_A

    #define GNT_KEY_CTRL_A     "\001"

### GNT_KEY_CTRL_B

    #define GNT_KEY_CTRL_B     "\002"

### GNT_KEY_CTRL_D

    #define GNT_KEY_CTRL_D     "\004"

### GNT_KEY_CTRL_E

    #define GNT_KEY_CTRL_E     "\005"

### GNT_KEY_CTRL_F

    #define GNT_KEY_CTRL_F     "\006"

### GNT_KEY_CTRL_G

    #define GNT_KEY_CTRL_G     "\007"

### GNT_KEY_CTRL_H

    #define GNT_KEY_CTRL_H     "\010"

### GNT_KEY_CTRL_I

    #define GNT_KEY_CTRL_I     "\011"

### GNT_KEY_CTRL_J

    #define GNT_KEY_CTRL_J     "\012"

### GNT_KEY_CTRL_K

    #define GNT_KEY_CTRL_K     "\013"

### GNT_KEY_CTRL_L

    #define GNT_KEY_CTRL_L     "\014"

### GNT_KEY_CTRL_M

    #define GNT_KEY_CTRL_M     "\012"

### GNT_KEY_CTRL_N

    #define GNT_KEY_CTRL_N     "\016"

### GNT_KEY_CTRL_O

    #define GNT_KEY_CTRL_O     "\017"

### GNT_KEY_CTRL_P

    #define GNT_KEY_CTRL_P     "\020"

### GNT_KEY_CTRL_R

    #define GNT_KEY_CTRL_R     "\022"

### GNT_KEY_CTRL_T

    #define GNT_KEY_CTRL_T     "\024"

### GNT_KEY_CTRL_U

    #define GNT_KEY_CTRL_U     "\025"

### GNT_KEY_CTRL_V

    #define GNT_KEY_CTRL_V     "\026"

### GNT_KEY_CTRL_W

    #define GNT_KEY_CTRL_W     "\027"

### GNT_KEY_CTRL_X

    #define GNT_KEY_CTRL_X     "\030"

### GNT_KEY_CTRL_Y

    #define GNT_KEY_CTRL_Y     "\031"

### GNT_KEY_F1

    #define GNT_KEY_F1         SAFE(key_f1)

### GNT_KEY_F2

    #define GNT_KEY_F2         SAFE(key_f2)

### GNT_KEY_F3

    #define GNT_KEY_F3         SAFE(key_f3)

### GNT_KEY_F4

    #define GNT_KEY_F4         SAFE(key_f4)

### GNT_KEY_F5

    #define GNT_KEY_F5         SAFE(key_f5)

### GNT_KEY_F6

    #define GNT_KEY_F6         SAFE(key_f6)

### GNT_KEY_F7

    #define GNT_KEY_F7         SAFE(key_f7)

### GNT_KEY_F8

    #define GNT_KEY_F8         SAFE(key_f8)

### GNT_KEY_F9

    #define GNT_KEY_F9         SAFE(key_f9)

### GNT_KEY_F10

    #define GNT_KEY_F10        SAFE(key_f10)

### GNT_KEY_F11

    #define GNT_KEY_F11        SAFE(key_f11)

### GNT_KEY_F12

    #define GNT_KEY_F12        SAFE(key_f12)