Mercurial > pidgin
comparison finch/libgnt/gntkeys.c @ 19175:c79177766e13
Fix faulty merge.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sat, 11 Aug 2007 09:32:06 +0000 |
parents | c6282dc3fb9f |
children |
comparison
equal
deleted
inserted
replaced
19174:974f9298814c | 19175:c79177766e13 |
---|---|
70 INSERT_KEY("end", GNT_KEY_END); | 70 INSERT_KEY("end", GNT_KEY_END); |
71 INSERT_KEY("pageup", GNT_KEY_PGUP); | 71 INSERT_KEY("pageup", GNT_KEY_PGUP); |
72 INSERT_KEY("pagedown", GNT_KEY_PGDOWN); | 72 INSERT_KEY("pagedown", GNT_KEY_PGDOWN); |
73 INSERT_KEY("insert", GNT_KEY_INS); | 73 INSERT_KEY("insert", GNT_KEY_INS); |
74 INSERT_KEY("delete", GNT_KEY_DEL); | 74 INSERT_KEY("delete", GNT_KEY_DEL); |
75 INSERT_KEY("back_tab", GNT_KEY_BACK_TAB); | |
75 | 76 |
76 INSERT_KEY("left", GNT_KEY_LEFT); | 77 INSERT_KEY("left", GNT_KEY_LEFT); |
77 INSERT_KEY("right", GNT_KEY_RIGHT); | 78 INSERT_KEY("right", GNT_KEY_RIGHT); |
78 INSERT_KEY("up", GNT_KEY_UP); | 79 INSERT_KEY("up", GNT_KEY_UP); |
79 INSERT_KEY("down", GNT_KEY_DOWN); | 80 INSERT_KEY("down", GNT_KEY_DOWN); |
203 struct _node *n = NULL; | 204 struct _node *n = NULL; |
204 if (!path || !*path) { | 205 if (!path || !*path) { |
205 node->flags |= IS_END; | 206 node->flags |= IS_END; |
206 return; | 207 return; |
207 } | 208 } |
208 while (*path && node->next[*path]) { | 209 while (*path && node->next[(unsigned char)*path]) { |
209 node = node->next[*path]; | 210 node = node->next[(unsigned char)*path]; |
210 node->ref++; | 211 node->ref++; |
211 path++; | 212 path++; |
212 } | 213 } |
213 if (!*path) | 214 if (!*path) |
214 return; | 215 return; |
215 n = g_new0(struct _node, 1); | 216 n = g_new0(struct _node, 1); |
216 n->ref = 1; | 217 n->ref = 1; |
217 node->next[*path++] = n; | 218 node->next[(unsigned char)*path++] = n; |
218 add_path(n, path); | 219 add_path(n, path); |
219 } | 220 } |
220 | 221 |
221 void gnt_keys_add_combination(const char *path) | 222 void gnt_keys_add_combination(const char *path) |
222 { | 223 { |
227 { | 228 { |
228 struct _node *next = NULL; | 229 struct _node *next = NULL; |
229 | 230 |
230 if (!*path) | 231 if (!*path) |
231 return; | 232 return; |
232 next = node->next[*path]; | 233 next = node->next[(unsigned char)*path]; |
233 if (!next) | 234 if (!next) |
234 return; | 235 return; |
235 del_path(next, path + 1); | 236 del_path(next, path + 1); |
236 next->ref--; | 237 next->ref--; |
237 if (next->ref == 0) { | 238 if (next->ref == 0) { |
238 node->next[*path] = NULL; | 239 node->next[(unsigned char)*path] = NULL; |
239 g_free(next); | 240 g_free(next); |
240 } | 241 } |
241 } | 242 } |
242 | 243 |
243 void gnt_keys_del_combination(const char *path) | 244 void gnt_keys_del_combination(const char *path) |
249 { | 250 { |
250 int depth = 0; | 251 int depth = 0; |
251 struct _node *n = &root; | 252 struct _node *n = &root; |
252 | 253 |
253 root.flags &= ~IS_END; | 254 root.flags &= ~IS_END; |
254 while (*path && n->next[*path] && !(n->flags & IS_END)) { | 255 while (*path && n->next[(unsigned char)*path] && !(n->flags & IS_END)) { |
255 if (!g_ascii_isspace(*path) && | 256 if (!g_ascii_isspace(*path) && |
256 !g_ascii_iscntrl(*path) && | 257 !g_ascii_iscntrl(*path) && |
257 !g_ascii_isgraph(*path)) | 258 !g_ascii_isgraph(*path)) |
258 return 0; | 259 return 0; |
259 n = n->next[*path++]; | 260 n = n->next[(unsigned char)*path++]; |
260 depth++; | 261 depth++; |
261 } | 262 } |
262 | 263 |
263 if (!(n->flags & IS_END)) | 264 if (!(n->flags & IS_END)) |
264 depth = 0; | 265 depth = 0; |