summaryrefslogtreecommitdiffstats
path: root/key-string.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-07-21 17:57:29 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-07-21 17:57:29 +0000
commit725938fb85290ca67ab50e27f9cacb870ff56c63 (patch)
treec0e4b6e6f5066f87075c14b771d20314408fb5f4 /key-string.c
parentc6012aaabc1eb10f42f77a1836c6e38faa7e396e (diff)
Tidy up keys: use an enum for the key codes, and remove the macros which just
wrap flag sets/clears/tests.
Diffstat (limited to 'key-string.c')
-rw-r--r--key-string.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/key-string.c b/key-string.c
index cf146b98..d70fe69b 100644
--- a/key-string.c
+++ b/key-string.c
@@ -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);