Mercurial > pidgin.yaz
comparison finch/libgnt/gntkeys.c @ 24098:dc8fac020fad
Fix a bug where some key-bindings wouldn't work with some .
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sat, 20 Sep 2008 02:45:13 +0000 |
parents | ded0a9cf1785 |
children | 23687caad265 |
comparison
equal
deleted
inserted
replaced
24097:f3788288961b | 24098:dc8fac020fad |
---|---|
45 term = getenv("TERM"); | 45 term = getenv("TERM"); |
46 if (!term) | 46 if (!term) |
47 term = ""; /* Just in case */ | 47 term = ""; /* Just in case */ |
48 } | 48 } |
49 | 49 |
50 if (strcmp(term, "xterm") == 0 || strcmp(term, "rxvt") == 0) { | 50 if (strstr(term, "xterm") == term || strcmp(term, "rxvt") == 0) { |
51 gnt_key_cup = "\033" "[1;5A"; | 51 gnt_key_cup = "\033" "[1;5A"; |
52 gnt_key_cdown = "\033" "[1;5B"; | 52 gnt_key_cdown = "\033" "[1;5B"; |
53 gnt_key_cright = "\033" "[1;5C"; | 53 gnt_key_cright = "\033" "[1;5C"; |
54 gnt_key_cleft = "\033" "[1;5D"; | 54 gnt_key_cleft = "\033" "[1;5D"; |
55 } else if (strcmp(term, "screen") == 0 || strcmp(term, "rxvt-unicode") == 0) { | 55 } else if (strstr(term, "screen") == term || strcmp(term, "rxvt-unicode") == 0) { |
56 gnt_key_cup = "\033" "Oa"; | 56 gnt_key_cup = "\033" "Oa"; |
57 gnt_key_cdown = "\033" "Ob"; | 57 gnt_key_cdown = "\033" "Ob"; |
58 gnt_key_cright = "\033" "Oc"; | 58 gnt_key_cright = "\033" "Oc"; |
59 gnt_key_cleft = "\033" "Od"; | 59 gnt_key_cleft = "\033" "Od"; |
60 } | 60 } |
145 void gnt_keys_refine(char *text) | 145 void gnt_keys_refine(char *text) |
146 { | 146 { |
147 if (*text == 27 && *(text + 1) == '[' && | 147 if (*text == 27 && *(text + 1) == '[' && |
148 (*(text + 2) >= 'A' && *(text + 2) <= 'D')) { | 148 (*(text + 2) >= 'A' && *(text + 2) <= 'D')) { |
149 /* Apparently this is necessary for urxvt and screen and xterm */ | 149 /* Apparently this is necessary for urxvt and screen and xterm */ |
150 if (strcmp(term, "screen") == 0 || strcmp(term, "rxvt-unicode") == 0 || | 150 if (strstr(term, "screen") == term || strcmp(term, "rxvt-unicode") == 0 || |
151 strcmp(term, "xterm") == 0) | 151 strstr(term, "xterm") == term) |
152 *(text + 1) = 'O'; | 152 *(text + 1) = 'O'; |
153 } else if (*(unsigned char*)text == 195) { | 153 } else if (*(unsigned char*)text == 195) { |
154 if (*(text + 2) == 0 && strcmp(term, "xterm") == 0) { | 154 if (*(text + 2) == 0 && strstr(term, "xterm") == term) { |
155 *(text) = 27; | 155 *(text) = 27; |
156 *(text + 1) -= 64; /* Say wha? */ | 156 *(text + 1) -= 64; /* Say wha? */ |
157 } | 157 } |
158 } | 158 } |
159 } | 159 } |