[PATCH 2/2] ui/ncurses: Update keybindings for subsets

Jeremy Kerr jk at ozlabs.org
Tue Jul 12 18:50:45 AEST 2016


Hi Sam,

> 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

Neat!

> +/*
> + * ncurses doesn't define these and and KEY_MINUS is defined elsewhere;
> + * define some simple helpers for these
> + */
>  static bool key_is_minus(int key)
>  {
>  	return key == 055;
>  }

how about just

	return key == '-';

?

> +static bool key_is_plus(int key)
>  {
> -	return key == KEY_RIGHT;
> +	return key == 053;
>  }

and
	return key == '+';

In fact, do we need these helpers at all? We have direct comparisons
elsewhere in the code, and if we don't use magic octal numbers, then
it's clear what the comparisons do.

Cheers,


Jeremy


More information about the Petitboot mailing list