Mercurial > pidgin.yaz
comparison console/libgnt/gntkeys.c @ 14876:70623f0d5cdc
[gaim-migrate @ 17645]
Use terminfo/termcap information (from ncurses) as much as possible. There
still need to be some manual 'refinement' based on $TERM. I'll see if I
can get rid of those. Also, I am probably going to allow users to provide
information that terminfo can't provide, like the keycode for ctrl+up etc.
Let me know if any of the keybinding doesn't work.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 01 Nov 2006 03:38:23 +0000 |
parents | ae4cbed1b309 |
children | c01f62c83647 |
comparison
equal
deleted
inserted
replaced
14875:7357d46ba817 | 14876:70623f0d5cdc |
---|---|
1 #include "gntkeys.h" | 1 #include "gntkeys.h" |
2 | 2 |
3 #include <string.h> | 3 #include <string.h> |
4 | 4 |
5 const char *term; | |
6 | |
5 void gnt_keys_refine(char *text) | 7 void gnt_keys_refine(char *text) |
6 { | 8 { |
7 if (text[0] == 27) | 9 if (*text == 27 && *(text + 1) == '[' && *(text + 3) == '\0' && |
8 { | 10 (*(text + 2) >= 'A' || *(text + 2) <= 'D')) { |
9 /* These are for urxvt */ | 11 if (term == NULL) |
10 if (strcmp(text + 1, "Oa") == 0) | 12 term = getenv("TERM"); |
11 { | 13 /* Apparently this is necessary for urxvt and screen */ |
12 strcpy(text + 1, GNT_KEY_CTRL_UP); | 14 if (strcmp(term, "screen") == 0 || strcmp(term, "rxvt-unicode") == 0) |
13 } | 15 *(text + 1) = 'O'; |
14 else if (strcmp(text + 1, "Ob") == 0) | |
15 { | |
16 strcpy(text + 1, GNT_KEY_CTRL_DOWN); | |
17 } | |
18 } | |
19 else if ((unsigned char)text[0] == 195) | |
20 { | |
21 /* These for xterm */ | |
22 if (text[2] == 0) | |
23 { | |
24 text[0] = 27; | |
25 text[1] -= 64; | |
26 } | |
27 } | 16 } |
28 } | 17 } |
29 | 18 |