From 4fcc760158824fd6278746276931ba005df737c0 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 10 Jul 2016 20:01:23 +0200 Subject: [PATCH] tweaks: put some case labels closer to their statements Also condense some comments, and group keys with the same result together. --- src/winio.c | 53 ++++++++++++++++++++++------------------------------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/src/winio.c b/src/winio.c index 77e8e769..71f13838 100644 --- a/src/winio.c +++ b/src/winio.c @@ -503,41 +503,42 @@ int parse_kbinput(WINDOW *win) retval = ISSET(REBIND_DELETE) ? sc_seq_or(do_delete, 0) : sc_seq_or(do_backspace, 0); break; - case KEY_DOWN: #ifdef KEY_SDOWN /* ncurses and Slang don't support KEY_SDOWN. */ case KEY_SDOWN: #endif + case KEY_DOWN: retval = sc_seq_or(do_down_void, *kbinput); break; - case KEY_UP: #ifdef KEY_SUP /* ncurses and Slang don't support KEY_SUP. */ case KEY_SUP: #endif + case KEY_UP: retval = sc_seq_or(do_up_void, *kbinput); break; - case KEY_LEFT: #ifdef KEY_SLEFT /* Slang doesn't support KEY_SLEFT. */ case KEY_SLEFT: #endif + case KEY_LEFT: retval = sc_seq_or(do_left, *kbinput); break; - case KEY_RIGHT: #ifdef KEY_SRIGHT /* Slang doesn't support KEY_SRIGHT. */ case KEY_SRIGHT: #endif + case KEY_RIGHT: retval = sc_seq_or(do_right, *kbinput); break; #ifdef KEY_SHOME /* HP-UX 10-11 and Slang don't support KEY_SHOME. */ case KEY_SHOME: #endif +#ifdef KEY_HOME case KEY_HOME: - case KEY_A1: /* Home (7) on numeric keypad with - * NumLock off. */ +#endif + case KEY_A1: /* Home (7) on keypad with NumLock off. */ retval = sc_seq_or(do_home, *kbinput); break; case KEY_BACKSPACE: @@ -559,62 +560,52 @@ int parse_kbinput(WINDOW *win) break; #endif case KEY_NPAGE: - case KEY_C3: /* PageDown (4) on numeric keypad with - * NumLock off. */ + case KEY_C3: /* PageDown (4) on keypad with NumLock off. */ retval = sc_seq_or(do_page_down, *kbinput); break; case KEY_PPAGE: - case KEY_A3: /* PageUp (9) on numeric keypad with - * NumLock off. */ + case KEY_A3: /* PageUp (9) on keypad with NumLock off. */ retval = sc_seq_or(do_page_up, *kbinput); break; case KEY_ENTER: retval = sc_seq_or(do_enter, *kbinput); break; - case KEY_B2: /* Center (5) on numeric keypad with - * NumLock off. */ - retval = ERR; - break; - case KEY_C1: /* End (1) on numeric keypad with - * NumLock off. */ #ifdef KEY_SEND /* HP-UX 10-11 and Slang don't support KEY_SEND. */ case KEY_SEND: #endif +#ifdef KEY_END case KEY_END: +#endif + case KEY_C1: /* End (1) on keypad with NumLock off. */ retval = sc_seq_or(do_end, *kbinput); break; +#ifdef KEY_SBEG + /* Slang doesn't support KEY_SBEG. */ + case KEY_SBEG: +#endif #ifdef KEY_BEG /* Slang doesn't support KEY_BEG. */ - case KEY_BEG: /* Center (5) on numeric keypad with - * NumLock off. */ + case KEY_BEG: +#endif + case KEY_B2: /* Center (5) on keypad with NumLock off. */ retval = ERR; break; -#endif #ifdef KEY_CANCEL - /* Slang doesn't support KEY_CANCEL. */ - case KEY_CANCEL: #ifdef KEY_SCANCEL /* Slang doesn't support KEY_SCANCEL. */ case KEY_SCANCEL: #endif + /* Slang doesn't support KEY_CANCEL. */ + case KEY_CANCEL: retval = first_sc_for(currmenu, do_cancel)->seq; break; #endif -#ifdef KEY_SBEG - /* Slang doesn't support KEY_SBEG. */ - case KEY_SBEG: /* Center (5) on numeric keypad with - * NumLock off. */ - retval = ERR; - break; -#endif +#ifdef KEY_SUSPEND #ifdef KEY_SSUSPEND /* Slang doesn't support KEY_SSUSPEND. */ case KEY_SSUSPEND: - retval = sc_seq_or(do_suspend_void, 0); - break; #endif -#ifdef KEY_SUSPEND /* Slang doesn't support KEY_SUSPEND. */ case KEY_SUSPEND: retval = sc_seq_or(do_suspend_void, 0);