diff options
Diffstat (limited to 'key-string.c')
-rw-r--r-- | key-string.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/key-string.c b/key-string.c index da82c9fb..c83b9236 100644 --- a/key-string.c +++ b/key-string.c @@ -1,4 +1,4 @@ -/* $Id: key-string.c,v 1.18 2009-07-14 06:38:14 nicm Exp $ */ +/* $Id: key-string.c,v 1.19 2009-07-22 16:24:59 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -126,7 +126,7 @@ key_string_lookup_string(const char *string) } key = key_string_search_table(ptr); if (key != KEYC_NONE) - return (KEYC_ADDCTL(key)); + return (key | KEYC_CTRL); return (KEYC_NONE); } @@ -137,11 +137,11 @@ key_string_lookup_string(const char *string) if (ptr[1] == '\0') { if (ptr[0] < 32 || ptr[0] > 127) return (KEYC_NONE); - return (KEYC_ADDESC(ptr[0])); + return (ptr[0] | KEYC_ESCAPE); } key = key_string_lookup_string(ptr); if (key != KEYC_NONE) - return (KEYC_ADDESC(key)); + return (key | KEYC_ESCAPE); return (KEYC_NONE); } @@ -158,20 +158,20 @@ key_string_lookup_key(int key) if (key == 127) return (NULL); - if (KEYC_ISESC(key)) { - if ((s = key_string_lookup_key(KEYC_REMOVEESC(key))) == NULL) + if (key & KEYC_ESCAPE) { + if ((s = key_string_lookup_key(key & ~KEYC_ESCAPE)) == NULL) return (NULL); xsnprintf(tmp2, sizeof tmp2, "M-%s", s); return (tmp2); } - if (KEYC_ISCTL(key)) { - if ((s = key_string_lookup_key(KEYC_REMOVECTL(key))) == NULL) + if (key & KEYC_CTRL) { + if ((s = key_string_lookup_key(key & ~KEYC_CTRL)) == NULL) return (NULL); xsnprintf(tmp2, sizeof tmp2, "C-%s", s); return (tmp2); } - if (KEYC_ISSFT(key)) { - if ((s = key_string_lookup_key(KEYC_REMOVESFT(key))) == NULL) + if (key & KEYC_SHIFT) { + if ((s = key_string_lookup_key(key & ~KEYC_SHIFT)) == NULL) return (NULL); xsnprintf(tmp2, sizeof tmp2, "S-%s", s); return (tmp2); |