public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* nconfig - F2, F3 misbehaves..
@ 2010-08-08 15:42 Sam Ravnborg
  2010-08-08 16:11 ` Nir Tzachar
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Sam Ravnborg @ 2010-08-08 15:42 UTC (permalink / raw)
  To: nir.tzachar, linux-kbuild, Michal Marek

Hi Nir.

When I press F2 at one of the top-level menus
then nconfig exits and a '~' is written to stdout.

Same happens when I press F3.

If I press F2 or F3 at a submenu then I see only the README,
and when I get back I am one level up in the menus.

I have not tried to debug this.
It happens with and without the search patch.


	Sam

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: nconfig - F2, F3 misbehaves..
  2010-08-08 15:42 nconfig - F2, F3 misbehaves Sam Ravnborg
@ 2010-08-08 16:11 ` Nir Tzachar
  2010-08-08 17:08 ` [PATCH] nconfig: properly map function keys nir.tzachar
  2010-08-08 17:11 ` resend " nir.tzachar
  2 siblings, 0 replies; 5+ messages in thread
From: Nir Tzachar @ 2010-08-08 16:11 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: linux-kbuild, Michal Marek

On Sun, Aug 8, 2010 at 6:42 PM, Sam Ravnborg <sam@ravnborg.org> wrote:
> Hi Nir.
>
> When I press F2 at one of the top-level menus
> then nconfig exits and a '~' is written to stdout.
>
> Same happens when I press F3.
>
> If I press F2 or F3 at a submenu then I see only the README,
> and when I get back I am one level up in the menus.

This implies that the function keys are not processed correctly by
ncurses; e.g., they are seen as two characters, one of them is ESC. I
believe this is the reason why you are getting one menu back.

> I have not tried to debug this.
> It happens with and without the search patch.

Can you please try with a different terminal emulator? Also check that
you have a terminfo file which matches your terminal and TERM
environment variable.

>
>        Sam
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] nconfig: properly map function keys.
  2010-08-08 15:42 nconfig - F2, F3 misbehaves Sam Ravnborg
  2010-08-08 16:11 ` Nir Tzachar
@ 2010-08-08 17:08 ` nir.tzachar
  2010-08-08 17:11 ` resend " nir.tzachar
  2 siblings, 0 replies; 5+ messages in thread
From: nir.tzachar @ 2010-08-08 17:08 UTC (permalink / raw)
  To: sam, mmarek; +Cc: linux-kbuild, linux-kernel, nir.tzachar

From: Nir Tzachar <nir.tzachar@gmail.com>

Hi Sam. Please try the following patch and see if it helps.


Subject: [PATCH] nconfig: properly map function keys.
When $TERM=xterm,xterm-color,vt220 map function keys properly.

Signed-off-by: Nir Tzachar <nir.tzachar@gmail.com>
---
 scripts/kconfig/nconf.c |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index c6feb41..a641a66 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -1537,13 +1537,13 @@ int main(int ac, char **av)
 
 	/* Initialize curses */
 	initscr();
-	/* set color theme */
-	set_colors();
-
 	cbreak();
 	noecho();
 	keypad(stdscr, TRUE);
 	curs_set(0);
+	/* set color theme */
+	set_colors();
+
 
 	if (COLS < 75 || LINES < 20) {
 		endwin();
@@ -1552,6 +1552,23 @@ int main(int ac, char **av)
 		return 1;
 	}
 
+	const char *term = getenv("TERM");
+	if (strcmp(term, "xterm") == 0 ||
+	    strcmp(term, "xterm-color") == 0 ||
+	    strcmp(term, "vt220") == 0) {
+		define_key("\033[H", KEY_HOME);
+		define_key("\033[F", KEY_END);
+		define_key("\033OP", KEY_F(1));
+		define_key("\033OQ", KEY_F(2));
+		define_key("\033OR", KEY_F(3));
+		define_key("\033OS", KEY_F(4));
+		define_key("\033[16~", KEY_F(5));
+		define_key("\033[17~", KEY_F(6));
+		define_key("\033[18", KEY_F(7));
+		define_key("\033[19~", KEY_F(8));
+		define_key("\033[20~", KEY_F(9));
+	}
+
 	notimeout(stdscr, FALSE);
 	ESCDELAY = 1;
 
-- 
1.6.4.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* resend [PATCH] nconfig: properly map function keys.
  2010-08-08 15:42 nconfig - F2, F3 misbehaves Sam Ravnborg
  2010-08-08 16:11 ` Nir Tzachar
  2010-08-08 17:08 ` [PATCH] nconfig: properly map function keys nir.tzachar
@ 2010-08-08 17:11 ` nir.tzachar
  2010-08-08 18:58   ` Sam Ravnborg
  2 siblings, 1 reply; 5+ messages in thread
From: nir.tzachar @ 2010-08-08 17:11 UTC (permalink / raw)
  To: sam, mmarek; +Cc: linux-kbuild, linux-kernel, nir.tzachar

From: Nir Tzachar <nir.tzachar@gmail.com>

Previous patch was missing a '~' in F7.

When $TERM=xterm,xterm-color,vt220 map function keys properly.

Signed-off-by: Nir Tzachar <nir.tzachar@gmail.com>
---
 scripts/kconfig/nconf.c |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index c6feb41..a641a66 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -1537,13 +1537,13 @@ int main(int ac, char **av)
 
 	/* Initialize curses */
 	initscr();
-	/* set color theme */
-	set_colors();
-
 	cbreak();
 	noecho();
 	keypad(stdscr, TRUE);
 	curs_set(0);
+	/* set color theme */
+	set_colors();
+
 
 	if (COLS < 75 || LINES < 20) {
 		endwin();
@@ -1552,6 +1552,23 @@ int main(int ac, char **av)
 		return 1;
 	}
 
+	const char *term = getenv("TERM");
+	if (strcmp(term, "xterm") == 0 ||
+	    strcmp(term, "xterm-color") == 0 ||
+	    strcmp(term, "vt220") == 0) {
+		define_key("\033[H", KEY_HOME);
+		define_key("\033[F", KEY_END);
+		define_key("\033OP", KEY_F(1));
+		define_key("\033OQ", KEY_F(2));
+		define_key("\033OR", KEY_F(3));
+		define_key("\033OS", KEY_F(4));
+		define_key("\033[16~", KEY_F(5));
+		define_key("\033[17~", KEY_F(6));
+		define_key("\033[18~", KEY_F(7));
+		define_key("\033[19~", KEY_F(8));
+		define_key("\033[20~", KEY_F(9));
+	}
+
 	notimeout(stdscr, FALSE);
 	ESCDELAY = 1;
 
-- 
1.6.4.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: resend [PATCH] nconfig: properly map function keys.
  2010-08-08 17:11 ` resend " nir.tzachar
@ 2010-08-08 18:58   ` Sam Ravnborg
  0 siblings, 0 replies; 5+ messages in thread
From: Sam Ravnborg @ 2010-08-08 18:58 UTC (permalink / raw)
  To: nir.tzachar; +Cc: mmarek, linux-kbuild, linux-kernel

On Sun, Aug 08, 2010 at 08:11:00PM +0300, nir.tzachar@gmail.com wrote:
> From: Nir Tzachar <nir.tzachar@gmail.com>
> 
> Previous patch was missing a '~' in F7.
> 
> When $TERM=xterm,xterm-color,vt220 map function keys properly.
> 
> Signed-off-by: Nir Tzachar <nir.tzachar@gmail.com>
> ---
>  scripts/kconfig/nconf.c |   23 ++++++++++++++++++++---
>  1 files changed, 20 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
> index c6feb41..a641a66 100644
> --- a/scripts/kconfig/nconf.c
> +++ b/scripts/kconfig/nconf.c
> @@ -1537,13 +1537,13 @@ int main(int ac, char **av)
>  
>  	/* Initialize curses */
>  	initscr();
> -	/* set color theme */
> -	set_colors();
> -
>  	cbreak();
>  	noecho();
>  	keypad(stdscr, TRUE);
>  	curs_set(0);
> +	/* set color theme */
> +	set_colors();
> +
>  
>  	if (COLS < 75 || LINES < 20) {
>  		endwin();
> @@ -1552,6 +1552,23 @@ int main(int ac, char **av)
>  		return 1;
>  	}
>  
> +	const char *term = getenv("TERM");
> +	if (strcmp(term, "xterm") == 0 ||
> +	    strcmp(term, "xterm-color") == 0 ||
> +	    strcmp(term, "vt220") == 0) {
> +		define_key("\033[H", KEY_HOME);
> +		define_key("\033[F", KEY_END);
> +		define_key("\033OP", KEY_F(1));
> +		define_key("\033OQ", KEY_F(2));
> +		define_key("\033OR", KEY_F(3));
> +		define_key("\033OS", KEY_F(4));

I had to change the above to "\033[11~", "\033[12~" etc, then it worked.
My terminal emulation is xterm and I did not try any other.

	Sam


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-08-08 18:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-08 15:42 nconfig - F2, F3 misbehaves Sam Ravnborg
2010-08-08 16:11 ` Nir Tzachar
2010-08-08 17:08 ` [PATCH] nconfig: properly map function keys nir.tzachar
2010-08-08 17:11 ` resend " nir.tzachar
2010-08-08 18:58   ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox