summaryrefslogtreecommitdiffstats
path: root/ui/ncurses/nc-widgets.c
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-07-12 14:18:18 +1000
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-07-13 15:09:09 +1000
commit96f9b8cd29dae248838d4221f3cb1c38e3aa1396 (patch)
tree454f4ed168e0d642570952fbdcb5f5078c059e69 /ui/ncurses/nc-widgets.c
parent6878bbdd7bb522f87ff097320e95e6a3c67d35f1 (diff)
downloadtalos-petitboot-96f9b8cd29dae248838d4221f3cb1c38e3aa1396.tar.gz
talos-petitboot-96f9b8cd29dae248838d4221f3cb1c38e3aa1396.zip
ui/ncurses: Update keybindings for subsets
We now use KEY_LEFT and KEY_RIGHT for general navigation; update subset_process_key() to use the following keybindings: Reorder items up/down: Minus/Plus keys (-/+) Delete item: Delete or Backspace Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'ui/ncurses/nc-widgets.c')
-rw-r--r--ui/ncurses/nc-widgets.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/ui/ncurses/nc-widgets.c b/ui/ncurses/nc-widgets.c
index c5c4cec..50909ab 100644
--- a/ui/ncurses/nc-widgets.c
+++ b/ui/ncurses/nc-widgets.c
@@ -162,21 +162,6 @@ static bool key_is_select(int key)
return key == ' ' || key == '\r' || key == '\n' || key == KEY_ENTER;
}
-static bool key_is_minus(int key)
-{
- return key == 055;
-}
-
-static bool key_is_left(int key)
-{
- return key == KEY_LEFT;
-}
-
-static bool key_is_right(int key)
-{
- return key == KEY_RIGHT;
-}
-
static bool process_key_nop(struct nc_widget *widget __attribute__((unused)),
FORM *form __attribute((unused)),
int key __attribute__((unused)))
@@ -522,7 +507,7 @@ static bool subset_process_key(struct nc_widget *w, FORM *form, int key)
int i, val, opt_idx = -1;
FIELD *field;
- if (!key_is_minus(key) && !key_is_left(key) && !key_is_right(key))
+ if (key != '-' && key != '+' && key != KEY_DC && key != KEY_BACKSPACE)
return false;
field = current_field(form);
@@ -538,10 +523,10 @@ static bool subset_process_key(struct nc_widget *w, FORM *form, int key)
if (opt_idx < 0)
return false;
- if (key_is_minus(key))
+ if (key == KEY_DC || key == KEY_BACKSPACE)
subset_delete_active(subset, opt_idx);
- if (key_is_left(key)){
+ if (key == '-') {
if (opt_idx == 0)
return true;
@@ -550,7 +535,7 @@ static bool subset_process_key(struct nc_widget *w, FORM *form, int key)
subset->active[opt_idx - 1] = val;
}
- if (key_is_right(key)){
+ if (key == '+') {
if (opt_idx >= subset->n_active - 1)
return true;
OpenPOWER on IntegriCloud