st
simple terminal
git clone https://9o.is/git/st.git
commit dc940d163a5c36d5312a416b6731348419f8ce1a parent e24799008b727b3ea22ffacddf91aff27f0fa60e Author: Mark Edgar <medgar123@gmail.com> Date: Sat, 19 Oct 2013 15:13:13 +0200 Simplify logic in kmap(). Diffstat:
| M | st.c | | | 19 | +++++-------------- |
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/st.c b/st.c @@ -3531,25 +3531,16 @@ kmap(KeySym k, uint state) { 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)) { + if(IS_SET(MODE_APPKEYPAD) ? kp->appkey < 0 : kp->appkey > 0) + continue; + if(term.numlock && kp->appkey == 2) continue; - } - if((kp->appcursor < 0 && IS_SET(MODE_APPCURSOR)) || - (kp->appcursor > 0 - && !IS_SET(MODE_APPCURSOR))) { + if(IS_SET(MODE_APPCURSOR) ? kp->appcursor < 0 : kp->appcursor > 0) continue; - } - if((kp->crlf < 0 && IS_SET(MODE_CRLF)) || - (kp->crlf > 0 && !IS_SET(MODE_CRLF))) { + if(IS_SET(MODE_CRLF) ? kp->crlf < 0 : kp->crlf > 0) continue; - } return kp->s; }