|
@@ -23,6 +23,7 @@
|
23
|
23
|
#include <console.h>
|
24
|
24
|
#include <gpxe/settings.h>
|
25
|
25
|
#include <gpxe/editbox.h>
|
|
26
|
+#include <gpxe/keys.h>
|
26
|
27
|
#include <gpxe/settings_ui.h>
|
27
|
28
|
|
28
|
29
|
/** @file
|
|
@@ -345,18 +346,19 @@ static int main_loop ( struct config_context *context ) {
|
345
|
346
|
draw_setting ( &widget );
|
346
|
347
|
color_set ( CPAIR_NORMAL, NULL );
|
347
|
348
|
|
348
|
|
- key = getchar();
|
|
349
|
+ key = getkey();
|
349
|
350
|
if ( widget.editing ) {
|
350
|
351
|
key = edit_setting ( &widget, key );
|
351
|
352
|
switch ( key ) {
|
352
|
|
- case 0x0a: /* Enter */
|
|
353
|
+ case CR:
|
|
354
|
+ case LF:
|
353
|
355
|
if ( ( rc = save_setting ( &widget ) ) != 0 ) {
|
354
|
356
|
alert ( " Could not set %s: %s ",
|
355
|
357
|
widget.setting->name,
|
356
|
358
|
strerror ( rc ) );
|
357
|
359
|
}
|
358
|
360
|
/* Fall through */
|
359
|
|
- case 0x03: /* Ctrl-C */
|
|
361
|
+ case CTRL_C:
|
360
|
362
|
load_setting ( &widget );
|
361
|
363
|
break;
|
362
|
364
|
default:
|
|
@@ -366,15 +368,15 @@ static int main_loop ( struct config_context *context ) {
|
366
|
368
|
} else {
|
367
|
369
|
next = current;
|
368
|
370
|
switch ( key ) {
|
369
|
|
- case '+':
|
|
371
|
+ case KEY_DOWN:
|
370
|
372
|
if ( next < ( NUM_SETTINGS - 1 ) )
|
371
|
373
|
next++;
|
372
|
374
|
break;
|
373
|
|
- case '-':
|
|
375
|
+ case KEY_UP:
|
374
|
376
|
if ( next > 0 )
|
375
|
377
|
next--;
|
376
|
378
|
break;
|
377
|
|
- case 0x13: /* Ctrl-S */
|
|
379
|
+ case CTRL_S:
|
378
|
380
|
if ( ( rc = nvo_save ( ugly_nvo_hack ) ) != 0){
|
379
|
381
|
alert ( " Could not save options: %s ",
|
380
|
382
|
strerror ( rc ) );
|