--- st.c | 48 +++++++++++++----------------------------------- 1 file changed, 13 insertions(+), 35 deletions(-) diff --git a/st.c b/st.c index 798cab5..43089bd 100644 --- a/st.c +++ b/st.c _AT_@ -3377,43 +3377,21 @@ kmap(KeySym k, uint state) { int i; /* Check for mapped keys out of X11 function keys. */ - for(i = 0; i < LEN(mappedkeys); i++) { - if(mappedkeys[i] == k) - break; - } - if(i == LEN(mappedkeys)) { - if((k & 0xFFFF) < 0xFD00) - return NULL; - } + for(i = 0; i < LEN(mappedkeys) && mappedkeys[i] != k; i++); + if(i == LEN(mappedkeys) && (k & 0xFFFF) < 0xFD00) return NULL; + /* Find first match in keymap */ for(kp = key; kp < key + LEN(key); kp++) { - if(kp->k != k) - continue; - - if(!match(kp->mask, state)) - continue; - - if(kp->appkey > 0) { - if(!IS_SET(MODE_APPKEYPAD)) - continue; - if(term.numlock && kp->appkey == 2) - continue; - } else if(kp->appkey < 0 && IS_SET(MODE_APPKEYPAD)) { - continue; - } - - if((kp->appcursor < 0 && IS_SET(MODE_APPCURSOR)) || - (kp->appcursor > 0 - && !IS_SET(MODE_APPCURSOR))) { - continue; - } - - if((kp->crlf < 0 && IS_SET(MODE_CRLF)) || - (kp->crlf > 0 && !IS_SET(MODE_CRLF))) { - continue; - } - - return kp->s; + if((kp->k == k) + && (match(kp->mask, state)) + && (kp->appkey != 2 || !term.numlock) + && (kp->appkey >= 0 || !IS_SET(MODE_APPKEYPAD)) + && (kp->appkey <= 0 || IS_SET(MODE_APPKEYPAD)) + && (kp->appcursor <= 0 || IS_SET(MODE_APPCURSOR)) + && (kp->appcursor >= 0 || !IS_SET(MODE_APPCURSOR)) + && (kp->crlf <= 0 || IS_SET(MODE_CRLF)) + && (kp->crlf >= 0 || !IS_SET(MODE_CRLF))) + return kp->s; } return NULL; -- 1.8.2 --------------070304020108090906010804--Received on Mon Sep 17 2001 - 00:00:00 CEST
This archive was generated by hypermail 2.3.0 : Sat Jun 22 2013 - 23:36:05 CEST