Emacs-like isearch for mconf.
Subsystems (3)
v3 cover Emacs-like isearch for mconf.
Hello,
v2 went out incomplete, without the patch.
Better so, because it would have just wasted people's time.
For v4 I am planning to implement Sam's idea to kind of being in a permanent isearch when not using special keys.
Changes in v3:
* Use current git tree to make the patch apply.
* Eliminate debugging output to stderr.
Changes in v2:
* Additionally to CTRL-s, \ can be used to start isearch.
* Raw mode is off by default an can be enabled by an environment variable MENUCONFIG_RAW_MODE.
* I also added a variable for toggling raw mode but did not implement anything else.
* The isearch indicator is now displayed as soon as isearch is started.
* Any key except \, CTRL-s, alphanumeric characters and space terminates isearch and -- except ESC ESC -- is further processed, e.g. ENTER terminates isearch and is then used to navigate into a submenu.
* Problems with mismatches and matches above the current position were fixed.
Dirk Gouders (1):
Emacs-like isearch for mconf.
Documentation/kbuild/kconfig.txt | 18 +++- scripts/kconfig/lxdialog/dialog.h | 6 ++ scripts/kconfig/lxdialog/menubox.c | 171 +++++++++++++++++++++++++++++++++++++ scripts/kconfig/lxdialog/util.c | 14 +++ scripts/kconfig/mconf.c | 47 ++++++++++ 5 files changed, 254 insertions(+), 2 deletions(-)
Signature · 1 line
2.16.4
RFC v3 1/1 Emacs-like isearch for mconf.
This patch implements isearch functionality for mconf as follows:
* isearch is started by pressing \ or CTRL-s; those keys can also be used to find further matches of an already entered string.
* isearch is implemented as a ring search.
* Once isearch is started, all alphanumerical characters and <space> are appended to a search string that is then be used to find matches in the menu.
* Any other character pressed terminates isearch and -- except ESC ESC -- that character is further processed, e.g. ENTER to enter a submenu without further input.
* To be able to use CTRL-s to start isearch, the terminal has to be put into raw mode and this can be done by setting the environment variable MENUCONFIG_RAW_MODE to a numeric value != 0.
An input example to navigate into the USB support menu under device drivers:
1) \ # start isearch
2) de # navigate to Device Drivers
3) ENTER # terminate isearch and enter submenu
4) \ # start isearch
5) USB # navigate to USB support
6) ENTER # terminate isearch and enter submenu
--- Documentation/kbuild/kconfig.txt | 18 +++- scripts/kconfig/lxdialog/dialog.h | 6 ++ scripts/kconfig/lxdialog/menubox.c | 171 +++++++++++++++++++++++++++++++++++++ scripts/kconfig/lxdialog/util.c | 14 +++ scripts/kconfig/mconf.c | 47 ++++++++++ 5 files changed, 254 insertions(+), 2 deletions(-)
Documentation/kbuild/kconfig.txt +16 -2
@@ -147,9 +147,11 @@ Its default value is "include/generated/autoconf.h". menuconfig -------------------------------------------------- -SEARCHING for CONFIG symbols +Menuconfig offers two search capabilities: + 1) SEARCHING for CONFIG symbols + 2) Incremental search in menus -Searching in menuconfig: +Searching for CONFIG symbols: The Search function searches for kernel configuration symbol names, so you have to know something close to what you are
@@ -178,6 +180,18 @@ Searching in menuconfig: first (and in alphabetical order), then come all other symbols, sorted in alphabetical order. +Incremental search in menus: + + Isearch is started by pressing <\>. After that, any alphanumerical + character typed in is used to form a growing string that is searched + for in the menu items. + + Isearch is realized as a ring search, restarting at the top if it + reaches the last menu item. + + Further matches of an already entered string can be found by + pressing <\> instead of more alphanumerical characters. + ______________________________________________________________________ User interface options for 'menuconfig'
scripts/kconfig/lxdialog/dialog.h +6 -0
@@ -50,6 +50,8 @@#define TR (params) _tracef params#define KEY_ESC 27 +#define KEY_CTRL_S 19 +#define KEY_ENTR 10#define TAB 9#define MAX_LEN 2048#define BUF_SIZE (10*1024)
@@ -145,6 +147,7 @@ struct dialog_info {extern struct dialog_info dlg;extern char dialog_input_result[];extern int saved_x, saved_y;/* Needed in signal handler in mconf.c */ +extern int raw_mode;/* Toggle raw mode */ /* * Function prototypes
@@ -238,6 +241,9 @@ int dialog_checklist(const char *title, const char *prompt, int height, int width, int list_height);int dialog_inputbox (const char *title,const char *prompt,int height,int width,const char *init); +int do_isearch (char *str,int choice,int scroll); +int dialog_isearch (WINDOW *menu,WINDOW *dialog,int *choice,int max_choice, +int box_x,int box_y,int menu_height,int *scroll);/* * This is the base for fictitious keys, which activate
scripts/kconfig/lxdialog/menubox.c +171 -0
197 lines not on this page · raw message
scripts/kconfig/lxdialog/util.c +14 -0
@@ -28,6 +28,8 @@ int saved_x, saved_y;struct dialog_info dlg; +int raw_mode;/* Toggle raw mode */ +static void set_mono_theme (void ) { dlg.screen.atr =A_NORMAL ;
@@ -236,6 +238,17 @@ static void color_setup(const char *theme)set_mono_theme (); } +/* +* Setup raw mode if MENUCONFIG_RAW_MODE +*/ +static void raw_setup (const char *val) +{ +if (val &&atoi (val)) { + raw_mode =1 ; +raw ();/* Enable CTRL-sequences*/ + } +} +/* * Set window to attribute 'attr' */
@@ -332,6 +345,7 @@ int init_dialog(const char *backtitle)keypad (stdscr, TRUE);cbreak (); +raw_setup (getenv ("MENUCONFIG_RAW_MODE" ));noecho ();dialog_clear ();
scripts/kconfig/mconf.c +47 -0
59 lines not on this page · raw message
Signature · 1 line
2.16.4