Decombining a repetitive condition.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4795 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2014-04-21 15:22:14 +00:00
parent 27a52a8def
commit 75ff3a9587
2 changed files with 28 additions and 25 deletions

View File

@ -12,6 +12,7 @@
* src/nano.h, src/proto.h: Delete some more unused stuff. * src/nano.h, src/proto.h: Delete some more unused stuff.
* src/rcfile.c (parse_binding), src/winio.c (get_mouseinput): * src/rcfile.c (parse_binding), src/winio.c (get_mouseinput):
Avoid three compiler warnings with --enable-debug. Avoid three compiler warnings with --enable-debug.
* src/global.c (assign_keyinfo): Decombine repetitive condition.
2014-04-16 Benno Schulenberg <bensberg@justemail.net> 2014-04-16 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (get_mouseinput): Properly find also the zeroeth * src/winio.c (get_mouseinput): Properly find also the zeroeth

View File

@ -439,40 +439,42 @@ void assign_keyinfo(sc *s)
} else /* RAWINPUT */ } else /* RAWINPUT */
s->seq = (int) s->keystr[0]; 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"))) if (s->type == CONTROL && (!strcasecmp(&s->keystr[1], "space")))
s->seq = 0; s->seq = 0;
else if (s->type == META && (!strcasecmp(&s->keystr[2], "space"))) else if (s->type == META && (!strcasecmp(&s->keystr[2], "space")))
s->seq = (int) ' '; s->seq = (int) ' ';
else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kup"))) else if (s->type == RAWINPUT) {
if (!strcasecmp(s->keystr, "kup"))
s->seq = KEY_UP; s->seq = KEY_UP;
else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kdown"))) else if (!strcasecmp(s->keystr, "kdown"))
s->seq = KEY_DOWN; s->seq = KEY_DOWN;
else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kleft"))) else if (!strcasecmp(s->keystr, "kleft"))
s->seq = KEY_LEFT; s->seq = KEY_LEFT;
else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kright"))) else if (!strcasecmp(s->keystr, "kright"))
s->seq = KEY_RIGHT; s->seq = KEY_RIGHT;
else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kinsert"))) else if (!strcasecmp(s->keystr, "kinsert"))
s->seq = KEY_IC; s->seq = KEY_IC;
else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kdel"))) else if (!strcasecmp(s->keystr, "kdel"))
s->seq = KEY_DC; s->seq = KEY_DC;
else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kbsp"))) else if (!strcasecmp(s->keystr, "kbsp"))
s->seq = KEY_BACKSPACE; s->seq = KEY_BACKSPACE;
else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kenter"))) else if (!strcasecmp(s->keystr, "kenter"))
s->seq = KEY_ENTER; s->seq = KEY_ENTER;
else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kpup"))) else if (!strcasecmp(s->keystr, "kpup"))
s->seq = KEY_PPAGE; s->seq = KEY_PPAGE;
else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kpdown"))) else if (!strcasecmp(s->keystr, "kpdown"))
s->seq = KEY_NPAGE; s->seq = KEY_NPAGE;
#ifdef KEY_HOME #ifdef KEY_HOME
else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "khome"))) else if (!strcasecmp(s->keystr, "khome"))
s->seq = KEY_HOME; s->seq = KEY_HOME;
#endif #endif
#ifdef KEY_END #ifdef KEY_END
else if (s->type == RAWINPUT && (!strcasecmp(s->keystr, "kend"))) else if (!strcasecmp(s->keystr, "kend"))
s->seq = KEY_END; s->seq = KEY_END;
#endif #endif
} }
}
#ifdef DEBUG #ifdef DEBUG
void print_sclist(void) void print_sclist(void)