ui/ncurses: Treat left/right arrow keys properly
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>
Fri, 19 Aug 2016 01:55:57 +0000 (11:55 +1000)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Mon, 22 Aug 2016 23:50:04 +0000 (09:50 +1000)
It turns out ncurses helpfully provides REQ_LEFT_FIELD and
REQ_RIGHT_FIELD to navigate between visually horizontal fields. Update
widgetset_process_key() to use these for KEY_LEFT and KEY_RIGHT
respectively.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
ui/ncurses/nc-widgets.c

index 7dc2df3f1d1fc2138c001b7511bac6bfc0e8041a..15cec80f3594ae3600f2cecf891db28d4532901e 100644 (file)
@@ -1132,14 +1132,12 @@ bool widgetset_process_key(struct nc_widgetset *set, int key)
                tab = true;
                /* fall through */
        case KEY_UP:
-       case KEY_LEFT:
                req = REQ_SPREV_FIELD;
                break;
        case '\t':
                tab = true;
                /* fall through */
        case KEY_DOWN:
-       case KEY_RIGHT:
                req = REQ_SNEXT_FIELD;
                break;
        case KEY_PPAGE:
@@ -1148,6 +1146,12 @@ bool widgetset_process_key(struct nc_widgetset *set, int key)
        case KEY_NPAGE:
                req = REQ_SLAST_FIELD;
                break;
+       case KEY_LEFT:
+               req = REQ_LEFT_FIELD;
+               break;
+       case KEY_RIGHT:
+               req = REQ_RIGHT_FIELD;
+               break;
        }
 
        if (req) {