kconfig: nconf: Keep position after jump search
PATCH 1/1 kconfig: nconf: Keep position after jump search
In this Menuconfig, pressing the key in the (#) prefix will jump directly to that location. You will be returned to the current search results after exiting this new menu.
In nconfig, exiting always returns to the top of the search output, not to where the (#) was displayed on the search output screen.
This patch fixes that by saving the current position in the search.
--- scripts/kconfig/nconf.c | 3 ++- scripts/kconfig/nconf.gui.c | 12 +++++++++++- scripts/kconfig/nconf.h | 1 + 3 files changed, 14 insertions(+), 2 deletions(-)
scripts/kconfig/nconf.c +2 -1
@@ -749,7 +749,7 @@ static void search_conf(void)struct gstr res;struct gstr title;char *dialog_input; -int dres; +int dres, vscroll =0 , hscroll =0 ;bool again; title =str_new ();
@@ -790,6 +790,7 @@ static void search_conf(void) res =get_relations_str (sym_arr, &head); dres =show_scroll_win_ext (main_window,"Search Results" ,str_get (&res), + &vscroll, &hscroll, handle_search_keys, &data); again = false;if (dres >='1' && dres <='9' ) {
scripts/kconfig/nconf.gui.c +11 -1
@@ -501,11 +501,12 @@ void show_scroll_win(WINDOW *main_window, const char *title, const char *text) { - (void)show_scroll_win_ext(main_window, title, (char *)text, NULL, NULL); + (void)show_scroll_win_ext(main_window, title, (char *)text, NULL, NULL, NULL, NULL); }/* layman's scrollable window... */ int show_scroll_win_ext (WINDOW *main_window,const char *title,char *text, +int *vscroll,int *hscroll,extra_key_cb_fn extra_key_cb,void *data) {int res;
@@ -522,6 +523,11 @@ int show_scroll_win_ext(WINDOW *main_window, const char *title, char *text,PANEL *panel;bool done = false; +if (hscroll) + start_x = *hscroll; +if (vscroll) + start_y = *vscroll; +getmaxyx (stdscr, lines, columns);/* find the widest line of msg: */
@@ -624,6 +630,10 @@ int show_scroll_win_ext(WINDOW *main_window, const char *title, char *text, start_x = total_cols-text_cols; } +if (hscroll) + *hscroll = start_x; +if (vscroll) + *vscroll = start_y;del_panel (panel);delwin (win);refresh_all_windows (main_window);
scripts/kconfig/nconf.h +1 -0
@@ -81,6 +81,7 @@ int dialog_inputbox(WINDOW *main_window, const char *init, char **resultp, int *result_len);void refresh_all_windows (WINDOW *main_window);int show_scroll_win_ext (WINDOW *main_window,const char *title,char *text, +int *vscroll,int *hscroll,extra_key_cb_fn extra_key_cb,void *data); void show_scroll_win(WINDOW *main_window, const char *title,
Signature · 1 line
2.40.0
Hi Jesse,
Quoted 9 lines · Jesse Taube
In this Menuconfig, pressing the key in the (#) prefix will jump directly to that location. You will be returned to the current search results after exiting this new menu.
In nconfig, exiting always returns to the top of the search output, not to where the (#) was displayed on the search output screen.
This patch fixes that by saving the current position in the search.
This patch fixes the reported problem. Thanks, Jesse.
Quoted 3 lines
Reported-by Randy Dunlap <[email protected]>Signed-off-by Jesse Taube <[email protected]>
Now I have another issue. :(
Here is my test case: x86_64 defconfig.
SymSearch (F8) for MSR.
Page Down to #3. Select 3.X86_MSR is about 7 lines below the highlighted line in the menu, which is confusing and sometimes it's not obvious what the correct line for the symbol is.
In menuconfig, the highlighted line is precisely on X86_MSR.
Can nconfig be more precise about which menu line it highlights?
Thanks for your help.
Quoted 5 lines
--- scripts/kconfig/nconf.c | 3 ++- scripts/kconfig/nconf.gui.c | 12 +++++++++++- scripts/kconfig/nconf.h | 1 + 3 files changed, 14 insertions(+), 2 deletions(-)
Signature · 1 line
~Randy
Quoted 26 lines · Randy Dunlap
Hi Jesse,
Quoted 9 lines · Jesse Taube
In this Menuconfig, pressing the key in the (#) prefix will jump directly to that location. You will be returned to the current search results after exiting this new menu.
In nconfig, exiting always returns to the top of the search output, not to where the (#) was displayed on the search output screen.
This patch fixes that by saving the current position in the search.
This patch fixes the reported problem. Thanks, Jesse.
Quoted 3 lines
Reported-by Randy Dunlap <[email protected]>Signed-off-by Jesse Taube <[email protected]>Tested-by Randy Dunlap <[email protected]>Now I have another issue. :(
Here is my test case:
x86_64defconfig.
Quoted 7 lines
SymSearch (F8) for MSR.
Page Down to #3. Select 3.X86_MSRis about 7 lines below the highlighted line in the menu, which is confusing and sometimes it's not obvious what the correct line for the symbol is.In menuconfig, the highlighted line is precisely on
X86_MSR.
Oh jeez, how did I miss this?
I will fix this asap as this seems to be a big issue as it can easily cause confusion.
Weirdly all the test cases I used were fine, but I found a few more like this.
Thanks,
Jesse Taube
Quoted 14 lines
Can nconfig be more precise about which menu line it highlights?
Thanks for your help.
Quoted 5 lines
--- scripts/kconfig/nconf.c | 3 ++- scripts/kconfig/nconf.gui.c | 12 +++++++++++- scripts/kconfig/nconf.h | 1 + 3 files changed, 14 insertions(+), 2 deletions(-)--
~Randy
Quoted 34 lines · Jesse T
Quoted 32 lines · Randy Dunlap
Hi Jesse,
Quoted 9 lines · Jesse Taube
In this Menuconfig, pressing the key in the (#) prefix will jump directly to that location. You will be returned to the current search results after exiting this new menu.
In nconfig, exiting always returns to the top of the search output, not to where the (#) was displayed on the search output screen.
This patch fixes that by saving the current position in the search.
This patch fixes the reported problem. Thanks, Jesse.
Quoted 3 lines
Reported-by Randy Dunlap <[email protected]>Signed-off-by Jesse Taube <[email protected]>Tested-by Randy Dunlap <[email protected]>Now I have another issue. :(
Here is my test case:
x86_64defconfig.SymSearch (F8) for MSR.
Page Down to #3. Select 3.X86_MSRis about 7 lines below the highlighted line in the menu, which is confusing and sometimes it's not obvious what the correct line for the symbol is.
Quoted 6 lines
Quoted 1 line
In menuconfig, the highlighted line is precisely on
X86_MSR.Oh jeez, how did I miss this?
I will fix this asap as this seems to be a big issue as it can easily cause confusion.
Weirdly all the test cases I used were fine, but I found a few more like this.
As it turns out, your initial nconf search is not mature enough.
I will drop it from my tree.
Signature · 2 lines
Best Regards Masahiro Yamada