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

Samuel Mendoza-Jonas sam at mendozajonas.com
Wed Jul 13 08:31:09 AEST 2016


On Tue, 2016-07-12 at 16:50 +0800, Jeremy Kerr wrote:
> 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.

Aha, yes you're right. I think I was caught up in ncurses land (ie. patch
2), but yes at this point we're just comparing literal characters.
Thanks!

> 
> Cheers,
> 
> 
> Jeremy
> _______________________________________________
> Petitboot mailing list
> Petitboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/petitboot



More information about the Petitboot mailing list