diff mbox

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

Message ID 20160712070339.3524-1-sam@mendozajonas.com
State Superseded
Headers show

Commit Message

Sam Mendoza-Jonas July 12, 2016, 7:03 a.m. UTC
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
---
 ui/ncurses/nc-cui.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Antonio Ospite July 12, 2016, 7:35 a.m. UTC | #1
On Tue, 12 Jul 2016 17:03:38 +1000
Samuel Mendoza-Jonas <sam@mendozajonas.com> wrote:

> Signed-off-by: Samuel Mendoza-Jonas <sam@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?

Ciao,
   Antonio
Sam Mendoza-Jonas July 12, 2016, 10:40 p.m. UTC | #2
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@mendozajonas.com> wrote:
> 
> > 
> > Signed-off-by: Samuel Mendoza-Jonas <sam@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
>
diff mbox

Patch

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);
 
 	while (getch() != ERR)		/* flush stdin */
 		(void)0;