public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Voytik <dvv.kernel@gmail.com>
To: Michal Marek <mmarek@suse.cz>
Cc: Stephen Boyd <sboyd@codeaurora.org>,
	dvv.kernel@gmail.com, linux-kernel@vger.kernel.org,
	linux-kbuild@vger.kernel.org
Subject: [PATCH] nconf: add vi-style command keys for the menu navigation
Date: Fri, 28 Dec 2012 23:40:07 +0400	[thread overview]
Message-ID: <1356723607-17027-1-git-send-email-dvv.kernel@gmail.com> (raw)
In-Reply-To: <20121228185108.GA13644@voyt-hp>

Add alternative vi-style keys for the menu navigation:
<j>/<k> for down/up navigation, <C-f>/<C-b> for
page down/up, <g>/<G> for first/last menu item selection
and <l> for entering to a submenu.

Signed-off-by: Dmitry Voytik <dvv.kernel@gmail.com>
---
 scripts/kconfig/nconf.c |   29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index ce93e87..632447b 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -13,6 +13,8 @@
 #include "nconf.h"
 #include <ctype.h>
 
+#define KEY_CONTROL(k) ((k) & 0x1f)
+
 static const char nconf_readme[] = N_(
 "Overview\n"
 "--------\n"
@@ -38,10 +40,10 @@ static const char nconf_readme[] = N_(
 "\n"
 "Menus\n"
 "----------\n"
-"o  Use the Up/Down arrow keys (cursor keys) to highlight the item\n"
-"   you wish to change use <Enter> or <Space>. Goto submenu by \n"
-"   pressing <Enter> of <right-arrow>. Use <Esc> or <left-arrow> to go back.\n"
-"   Submenus are designated by \"--->\".\n"
+"o  Use the Up/Down arrow keys (cursor keys) or <j>/<k> to highlight\n"
+"   the item you wish to change use <Enter> or <Space>. Goto submenu by\n"
+"   pressing <Enter>, <right-arrow> or <l>. Use <Esc> or <left-arrow>\n"
+"   to go back. Submenus are designated by \"--->\".\n"
 "\n"
 "   Searching: pressing '/' triggers interactive search mode.\n"
 "              nconfig performs a case insensitive search for the string\n"
@@ -51,8 +53,8 @@ static const char nconf_readme[] = N_(
 "              match string. Pressing either '/' again or ESC exits\n"
 "              search mode. All other keys behave normally.\n"
 "\n"
-"   You may also use the <PAGE UP> and <PAGE DOWN> keys to scroll\n"
-"   unseen options into view.\n"
+"   You may also use the <PAGE UP> (<C-b>) and <PAGE DOWN> (<C-f>) keys\n"
+"   to scroll unseen options into view.\n"
 "\n"
 "o  To exit a menu use the just press <ESC> <F5> <F8> or <left-arrow>.\n"
 "\n"
@@ -1116,21 +1118,27 @@ static void conf(struct menu *menu)
 				break;
 			switch (res) {
 			case KEY_DOWN:
+			case 'j':
 				menu_driver(curses_menu, REQ_DOWN_ITEM);
 				break;
 			case KEY_UP:
+			case 'k':
 				menu_driver(curses_menu, REQ_UP_ITEM);
 				break;
 			case KEY_NPAGE:
+			case KEY_CONTROL('f'):
 				menu_driver(curses_menu, REQ_SCR_DPAGE);
 				break;
 			case KEY_PPAGE:
+			case KEY_CONTROL('b'):
 				menu_driver(curses_menu, REQ_SCR_UPAGE);
 				break;
 			case KEY_HOME:
+			case 'g':
 				menu_driver(curses_menu, REQ_FIRST_ITEM);
 				break;
 			case KEY_END:
+			case 'G':
 				menu_driver(curses_menu, REQ_LAST_ITEM);
 				break;
 			case 'h':
@@ -1141,7 +1149,7 @@ static void conf(struct menu *menu)
 			if (res == 10 || res == 27 ||
 				res == 32 || res == 'n' || res == 'y' ||
 				res == KEY_LEFT || res == KEY_RIGHT ||
-				res == 'm')
+				res == 'm' || res == 'l')
 				break;
 			refresh_all_windows(main_window);
 		}
@@ -1170,6 +1178,7 @@ static void conf(struct menu *menu)
 			else if (item_is_tag('m'))
 				conf(submenu);
 			break;
+		case 'l':
 		case KEY_RIGHT:
 		case 10: /* ENTER WAS PRESSED */
 			switch (item_tag()) {
@@ -1301,21 +1310,27 @@ static void conf_choice(struct menu *menu)
 				break;
 			switch (res) {
 			case KEY_DOWN:
+			case 'j':
 				menu_driver(curses_menu, REQ_DOWN_ITEM);
 				break;
 			case KEY_UP:
+			case 'k':
 				menu_driver(curses_menu, REQ_UP_ITEM);
 				break;
 			case KEY_NPAGE:
+			case KEY_CONTROL('f'):
 				menu_driver(curses_menu, REQ_SCR_DPAGE);
 				break;
 			case KEY_PPAGE:
+			case KEY_CONTROL('b'):
 				menu_driver(curses_menu, REQ_SCR_UPAGE);
 				break;
 			case KEY_HOME:
+			case 'g':
 				menu_driver(curses_menu, REQ_FIRST_ITEM);
 				break;
 			case KEY_END:
+			case 'G':
 				menu_driver(curses_menu, REQ_LAST_ITEM);
 				break;
 			case 'h':
-- 
1.7.9.5


  reply	other threads:[~2012-12-28 19:40 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-21 19:12 [PATCH] nconf: add j, k and l keys for menu navigation Dmitry Voytik
2012-12-21 20:23 ` Stephen Boyd
2012-12-22  5:27   ` Dmitry Voytik
2012-12-28 18:51 ` Dmitry Voytik
2012-12-28 19:40   ` Dmitry Voytik [this message]
2012-12-29 22:33     ` [PATCH 2/2] nconf: function keys line, change background color for better readability Roland Eggner
2013-01-14 22:20       ` Yann E. MORIN
2013-01-14 22:26         ` Yann E. MORIN
2012-12-29 22:34     ` [PATCH 1/2] nconf: add keybindings for vi-style menu navigation, rewrite help texts Roland Eggner
2013-01-08 22:04       ` Yann E. MORIN
2013-01-14 18:24       ` Yann E. MORIN
2013-01-15 16:10         ` Roland Eggner
2013-01-15 16:26           ` [PATCH v2 " Roland Eggner
2013-01-15 16:36             ` [PATCH v2stable " Roland Eggner
2013-01-15 17:39               ` Yann E. MORIN
2013-01-15 22:27             ` [PATCH v2 " Yann E. MORIN
2013-01-16 20:19               ` Roland Eggner
2013-01-16 12:48             ` Michal Marek
2013-01-08 21:57     ` [PATCH] nconf: add vi-style command keys for the menu navigation Yann E. MORIN
2013-01-14 22:10     ` Yann E. MORIN
2013-01-15 17:12       ` Roland Eggner
2013-01-15 17:38         ` Yann E. MORIN
2013-01-15 17:55           ` Roland Eggner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1356723607-17027-1-git-send-email-dvv.kernel@gmail.com \
    --to=dvv.kernel@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=sboyd@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox