Skip to contentSkip to conversation

i-search navigation for mconf

RFC New Dirk Gouders 1 participant 2 messages Jun 11, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v5 cover i-search navigation for mconf

Hello,

I reworked the prototype for the i-search navigation concept. It is now more thoroughly tested and hopefully not a waste of time to have a look at it.

For the focus-sensitive help text, I modified the function print_autowrap() and for now called it print_autowrap_fill(). It could replace the old function but does a bit more work than it.

With this navigation concept, mconf's behavior (in i-search mode) is quite different from the known one, most noticeably the need to switch
focus to the buttons to be able to use <y|n|m|space>. Ideas are very
welcome.

Interesting in i-search mode is the ability to not only search item strings, but also their selection marks. So, one can search for items selected as a module, for example.

Dirk

Changes in v5:

* More thoroughly tested code

* Hotkey navigation concept completely dropped

* Printable characters except special ones form the search string

* Focus-sensitive help text above menu

* DEL erases search string

* Matching string is highlighted in selected menu item

* README help text adjusted

Changes in v4:

* Prototype: consequent i-search navigation concept

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):
i-search navigation for mconf

 scripts/kconfig/lxdialog/dialog.h  |   3 +
 scripts/kconfig/lxdialog/menubox.c | 489 +++++++++++++++++++++++++++----------
 scripts/kconfig/lxdialog/util.c    | 106 +++++++-
 scripts/kconfig/mconf.c            |  68 ++++--
 4 files changed, 506 insertions(+), 160 deletions(-)
Signature · 1 line
2.16.4
#1 lore raw

RFC v5 1/1 i-search navigation for mconf

This patch implements an i-search navigation concept for mconf based on an idea of Sam Ravnborg:

* mconf now distinguishes if the focus is on the menu items or the buttons below it.

* At startup focus is on the menu items and printable characters (except the keys below) entered are used to form a string that is searched for.

* Hotkeys were sacrificed for the i-search navigation concept. However, focus on the buttons offers most of mconf's known behavior, except the TAB key and a change in the highlighting of menu items.

Keys with special meaning:

* BACKSPACE is used to remove the last character of the search string

* DEL clears the search string

* ENTER can be used to enter a submenu; it also clears the search string

* Horizontal arrow keys still cycle between the buttons but also switch focus to the buttons.

* The TAB key is now exclusively used to toggle the focus.

* Vertical arrow keys work everywhere.

* When the focus is on the buttons, all keys work the same as before this change -- except TAB and hotkeys.

* <\> (backslash) can be used to search for other occurences of an already entered string.

* To use y|n|m|<space> on an item, focus has to be on the buttons.

An example to navigate into the USB support menu under Device Drivers:

1) de # Navigates to the item "Device Drivers"
2) ENTER # Enter the submenu
3) USB # Navigate to the item "USB support"
4) ENTER # Enter the submenu

---
 scripts/kconfig/lxdialog/dialog.h  |   3 +
 scripts/kconfig/lxdialog/menubox.c | 489 +++++++++++++++++++++++++++----------
 scripts/kconfig/lxdialog/util.c    | 106 +++++++-
 scripts/kconfig/mconf.c            |  68 ++++--
 4 files changed, 506 insertions(+), 160 deletions(-)
scripts/kconfig/lxdialog/dialog.h +3 -0
index 0b00be5abaa6..28a3b42fdf71 100644
@@ -215,6 +215,8 @@ void end_dialog(int x, int y);
 void attr_clear(WINDOW * win, int height, int width, chtype attr);
 void dialog_clear(void);
 void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x);
+void print_autowrap_fill(WINDOW * win, const char *prompt, int width,
+			int height, int y, int x);
 void print_button(WINDOW * win, const char *label, int y, int x, int selected);
 void print_title(WINDOW *dialog, const char *title, int width);
 void draw_box(WINDOW * win, int y, int x, int height, int width, chtype box,
@@ -238,6 +240,7 @@ 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);
 
 /*
  * This is the base for fictitious keys, which activate
scripts/kconfig/lxdialog/menubox.c +356 -133

589 lines not on this page · raw message

scripts/kconfig/lxdialog/util.c +104 -2

143 lines not on this page · raw message

scripts/kconfig/mconf.c +43 -25

93 lines not on this page · raw message

Signature · 1 line
2.16.4