From: Benno Schulenberg Date: Mon, 21 Apr 2014 15:22:14 +0000 (+0000) Subject: Decombining a repetitive condition. X-Git-Tag: v2.3.3~135 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=75ff3a95873d157154dd44a1e7075d5df5197245;p=nano.git Decombining a repetitive condition. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4795 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 8b10e93c..0d4d3c23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ * src/nano.h, src/proto.h: Delete some more unused stuff. * src/rcfile.c (parse_binding), src/winio.c (get_mouseinput): Avoid three compiler warnings with --enable-debug. + * src/global.c (assign_keyinfo): Decombine repetitive condition. 2014-04-16 Benno Schulenberg * src/winio.c (get_mouseinput): Properly find also the zeroeth diff --git a/src/global.c b/src/global.c index 882b3f9f..96a3408b 100644 --- a/src/global.c +++ b/src/global.c @@ -439,39 +439,41 @@ void assign_keyinfo(sc *s) } else /* RAWINPUT */ s->seq = (int) s->keystr[0]; - /* Override some keys which don't bind as nicely as we'd like. */ + /* Override some keys which don't bind as easily as we'd like. */ if (s->type == CONTROL && (!strcasecmp(&s->keystr[1], "space"))) s->seq = 0; else if (s->type == META && (!strcasecmp(&s->keystr[2], "space"))) s->seq = (int) ' '; - else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kup"))) - s->seq = KEY_UP; - else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kdown"))) - s->seq = KEY_DOWN; - else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kleft"))) - s->seq = KEY_LEFT; - else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kright"))) - s->seq = KEY_RIGHT; - else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kinsert"))) - s->seq = KEY_IC; - else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kdel"))) - s->seq = KEY_DC; - else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kbsp"))) - s->seq = KEY_BACKSPACE; - else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kenter"))) - s->seq = KEY_ENTER; - else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kpup"))) - s->seq = KEY_PPAGE; - else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kpdown"))) - s->seq = KEY_NPAGE; + else if (s->type == RAWINPUT) { + if (!strcasecmp(s->keystr, "kup")) + s->seq = KEY_UP; + else if (!strcasecmp(s->keystr, "kdown")) + s->seq = KEY_DOWN; + else if (!strcasecmp(s->keystr, "kleft")) + s->seq = KEY_LEFT; + else if (!strcasecmp(s->keystr, "kright")) + s->seq = KEY_RIGHT; + else if (!strcasecmp(s->keystr, "kinsert")) + s->seq = KEY_IC; + else if (!strcasecmp(s->keystr, "kdel")) + s->seq = KEY_DC; + else if (!strcasecmp(s->keystr, "kbsp")) + s->seq = KEY_BACKSPACE; + else if (!strcasecmp(s->keystr, "kenter")) + s->seq = KEY_ENTER; + else if (!strcasecmp(s->keystr, "kpup")) + s->seq = KEY_PPAGE; + else if (!strcasecmp(s->keystr, "kpdown")) + s->seq = KEY_NPAGE; #ifdef KEY_HOME - else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "khome"))) - s->seq = KEY_HOME; + else if (!strcasecmp(s->keystr, "khome")) + s->seq = KEY_HOME; #endif #ifdef KEY_END - else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kend"))) - s->seq = KEY_END; + else if (!strcasecmp(s->keystr, "kend")) + s->seq = KEY_END; #endif + } } #ifdef DEBUG