ui/ncurses: Use sorted field navigation
authorSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Wed, 21 Jan 2015 04:25:15 +0000 (15:25 +1100)
committerSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Tue, 5 May 2015 05:03:41 +0000 (15:03 +1000)
Changing the visual order of widgets will cause their associated fields to be
out of order relative to the widgetset field array. Rather than manually
resorting the array, use sorted navigation to move according to a field's
visual positon

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

index 5c67d827b506e5372158586beeb761b9d2b1bce0..3daced1a68b56c9e2cb1628384f5b06c70968194 100644 (file)
@@ -1066,19 +1066,19 @@ bool widgetset_process_key(struct nc_widgetset *set, int key)
                tab = true;
                /* fall through */
        case KEY_UP:
                tab = true;
                /* fall through */
        case KEY_UP:
-               req = REQ_PREV_FIELD;
+               req = REQ_SPREV_FIELD;
                break;
        case '\t':
                tab = true;
                /* fall through */
        case KEY_DOWN:
                break;
        case '\t':
                tab = true;
                /* fall through */
        case KEY_DOWN:
-               req = REQ_NEXT_FIELD;
+               req = REQ_SNEXT_FIELD;
                break;
        case KEY_PPAGE:
                break;
        case KEY_PPAGE:
-               req = REQ_FIRST_FIELD;
+               req = REQ_SFIRST_FIELD;
                break;
        case KEY_NPAGE:
                break;
        case KEY_NPAGE:
-               req = REQ_LAST_FIELD;
+               req = REQ_SLAST_FIELD;
                break;
        }
 
                break;
        }