URI: 
       simpler input escape sequence management - iomenu - interactive terminal-based selection menu
  HTML git clone git://bitreich.org/iomenu git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/iomenu
   DIR Log
   DIR Files
   DIR Refs
   DIR Tags
   DIR README
   DIR LICENSE
       ---
   DIR commit 09d7cdbc37907c01400e2193f4eafba74736aa7d
   DIR parent 2425ac3f4cb13eef4db1e4e4d66feede9bf3ab84
  HTML Author: Josuah Demangeon <josuah.demangeon@gandi.net>
       Date:   Mon, 21 Aug 2017 15:40:31 +0200
       
       simpler input escape sequence management
       
       Diffstat:
         M iomenu.c                            |      35 ++++++++++---------------------
       
       1 file changed, 11 insertions(+), 24 deletions(-)
       ---
   DIR diff --git a/iomenu.c b/iomenu.c
       @@ -14,10 +14,9 @@
        
        #define  CONTROL(char) (char ^ 0x40)
        #define  ALT(char) (char + 0x80)
       +#define  ESC(char) (char + 0x80 + 0x80)
        #define  MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
        
       -enum { KEY_UP = 0x81, KEY_DOWN, PG_UP, PG_DOWN };
       -
        static struct winsize ws;
        static struct termios termios;
        static int            ttyfd;
       @@ -341,22 +340,26 @@ top:
                        filter();
                        break;
        
       -        case KEY_UP:
       +        case ESC('A'):  /* up */
                case CONTROL('P'):
                        move(-1);
                        break;
        
       -        case KEY_DOWN:
       +        case ESC('B'):  /* down */
                case CONTROL('N'):
                        move(+1);
                        break;
        
       -        case PG_UP:
       +        case ESC('5'):
       +                if (fgetc(stdin) != '~') break;
       +                /* FALLTHROUGH */
                case ALT('v'):
                        movepg(-1);
                        break;
        
       -        case PG_DOWN:
       +        case ESC('6'):
       +                if (fgetc(stdin) != '~') break;
       +                /* FALLTHROUGH */
                case CONTROL('V'):
                        movepg(+1);
                        break;
       @@ -373,24 +376,8 @@ top:
                        return EXIT_SUCCESS;
        
                case ALT('['):
       -                switch (fgetc(stdin)) {
       -                case 'A':
       -                        key = KEY_UP;
       -                        goto top;
       -                case 'B':
       -                        key = KEY_DOWN;
       -                        goto top;
       -                case '5':
       -                        if (fgetc(stdin) == '~') {
       -                                key = PG_UP;
       -                                goto top;
       -                        }
       -                case '6':
       -                        if (fgetc(stdin) == '~') {
       -                                key = PG_DOWN;
       -                                goto top;
       -                        }
       -                }
       +                key = ESC(fgetc(stdin));
       +                goto top;
        
                case 033: /* escape / alt */
                        key = ALT(fgetc(stdin));