[PATCH 1/2] ui/ncurses: define KEY_DC (delete key)

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


On Tue, 2016-07-12 at 09:35 +0200, Antonio Ospite wrote:
> On Tue, 12 Jul 2016 17:03:38 +1000
> Samuel Mendoza-Jonas <sam at mendozajonas.com> wrote:
> 
> > 
> > Signed-off-by: Samuel Mendoza-Jonas <sam at mendozajonas.com>
> > ---
> >  ui/ncurses/nc-cui.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c
> > index bd727a5..0c355cc 100644
> > --- a/ui/ncurses/nc-cui.c
> > +++ b/ui/ncurses/nc-cui.c
> > @@ -83,6 +83,7 @@ static void cui_start(void)
> >  	define_key("OF", KEY_END);
> >  	define_key("\x1b\x5b\x41", KEY_UP);
> >  	define_key("\x1b\x5b\x42", KEY_DOWN);
> > +	define_key("\x1b\x5b\x33\x7e", KEY_DC);
> > 
> 
> Just curios, why KEY_DC and not KEY_DELETE like, for example, linux
> does?

With define_key we're adding a control string that ncurses will recognise
as the delete key, which is originally defined in ncurses.h as KEY_DC. We
could probably use KEY_DELETE but this keeps us consistent when handling
keys in ncurses.

Cheers,
Sam

> 
> Ciao,
>    Antonio
> 



More information about the Petitboot mailing list