From: Nir Tzachar on
On Thu, Aug 5, 2010 at 9:19 PM, Randy Dunlap <randy.dunlap(a)oracle.com> wrote:
> On 08/05/10 11:13, Nir Tzachar wrote:
>> On Thu, Aug 5, 2010 at 8:04 PM, Randy Dunlap <randy.dunlap(a)oracle.com> wrote:
>>> On Tue, �3 Aug 2010 15:28:12 +0300 nir.tzachar(a)gmail.com wrote:
>>>
>>>> From: Nir Tzachar <nir.tzachar(a)gmail.com>
>>>>
>>>> Remove the old hotkeys feature, and replace by a regular string search.
>>>> Behaviour of search is as advised by Sam.
>>>>
>>>> From nconfig help:
>>>>
>>>> Searching: pressing '/' triggers search mode. nconfig performs a
>>>> � � � � � �regular string compare, case insensitive, starting at
>>>
>>> I would say: simple string compare
>>> "regular" has no meaning (at least for me) there.
>>
>> Regular means strcasecmp...
>
> That's not meaningful to a non-developer user.
> I'm a developer and it still has little meaning to me in this context.
>
>
>>>> � � � � � �the beginning of each menu line.\n"
>>>> � � � � � �Pressing the up/down keys highlights the previous/next
>>>> � � � � � �matching item. Backspace removes one character from the
>>>> � � � � � �match string. Pressing either '/' again or ESC exits\
>>>> � � � � � �search mode. All other keys behave normally.
>>>>
>>>> Miscellaneous other changes (including Rundy's Justin's input).
>>>
>>> Yes, the bottom menu and the typos are fixed. �Thanks.
>>>
>>> However, I'm not finding this terribly useful, mostly due to it starting
>>> comparison at the beginning of each menu line.
>>>
>>> E.g., I'd like to be able to find "emulations" in the top-level menu here:
>>> � � � �Executable file formats / Emulations �--->
>>> or I'd like to be able to find "crc" menu items in any sub-menu.
>>> Maybe I should just stick to config symbol searches. �I don't think it's all
>>> that likely that people will know how each menu line text begins.
>>>
>>>
>>
>> We can replace strcasecmp with strcasestr. I agree it would be more useful.
>
> Yes.
>
>>> As for the search UI, I'd rather that it be presented like the symbol search,
>>> in a box, instead of just a single line at the top of the screen.
>>
>> But then it is not interactive. I was aiming for something similar to
>> vim's search, where the search is matched as you type and the only
>> free terminal real-estate to display the match string was at the top
>> of the screen. I think such a minimal design is better than a
>> cumbersome text box which displays the search results afterwards (as
>> is symbol search), as the search is only intended for the currently
>> displayed menu and the user would usually just want to save the extra
>> typing of navigating to a specific menu item.
>
> OK, I expect that I'll just mostly use symbol search instead of this one then.
>
> The kicker for me is not how/where the dialog is -- it's this comment:
>
> �"as the search is only intended for the currently displayed menu"
>
> I think that's much too limiting.

A global search with an instant goto upon match cannot easily be
incorporated into nconfig's (or menuconfig's) design, as other menus
than the current one are not present.

>
>> Cheers.
>>
>>>> Signed-off-by: Nir Tzachar <nir.tzachar(a)gmail.com>
>>>> ---
>>>> �scripts/kconfig/nconf.c � � | �350 +++++++++++++++++++++++++------------------
>>>> �scripts/kconfig/nconf.gui.c | � 20 ++--
>>>> �scripts/kconfig/nconf.h � � | � �3 +-
>>>> �3 files changed, 213 insertions(+), 160 deletions(-)
>
>
> --
> ~Randy
> *** Remember to use Documentation/SubmitChecklist when testing your code ***
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Sam Ravnborg on
> >>
> >> Searching: pressing '/' triggers search mode. nconfig performs a
> >> � � � � � �regular string compare, case insensitive, starting at
> >
> > I would say: simple string compare
> > "regular" has no meaning (at least for me) there.

pressing '/' triggers interactive search mode. nconfig search for the
string in the menu prompts (no regex support).

[Just a suggestion for a bt different wording]

> > Maybe I should just stick to config symbol searches. �I don't think it's all
> > that likely that people will know how each menu line text begins.
> >
> >
>
> We can replace strcasecmp with strcasestr. I agree it would be more useful.

This is better.

>
> > As for the search UI, I'd rather that it be presented like the symbol search,
> > in a box, instead of just a single line at the top of the screen.
>
> But then it is not interactive. I was aiming for something similar to
> vim's search, where the search is matched as you type and the only
> free terminal real-estate to display the match string was at the top
> of the screen. I think such a minimal design is better than a
> cumbersome text box which displays the search results afterwards (as
> is symbol search), as the search is only intended for the currently
> displayed menu and the user would usually just want to save the extra
> typing of navigating to a specific menu item.

It was introduced to replace the "hotkey" support, and as such is useful.
If we want to search for content of all prompts then we should extend
the symbols search to do so.
Maybe we should just let it search for both symbols _and_ propmts.

If one search for HOTPLUG_CPU there is no hits in any propmts anyway.
And if one search for "Pentium" there is no config symbol hits.

Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Sam Ravnborg on
>
> or I'd like to be able to find "crc" menu items in any sub-menu.
> Maybe I should just stick to config symbol searches. I don't think it's all
> that likely that people will know how each menu line text begins.

Following patch extends symbols search to search _both_ for CONFIG_
symbols AND prompts.

I think this could be a usefull extension.
You are navigation much more around than me in the
Kconfig files / editors. What do you think?

As this is an extension in the core part it will take effect
for all the editors (which is good).
[gconf does not use sym_re_search() - I assume this feature is
missing in that editor].

I will cook up a proper patch only if I get positive feedback.

Sam

diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index e95718f..8cda9c0 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -842,6 +842,7 @@ struct symbol *sym_find(const char *name)

struct symbol **sym_re_search(const char *pattern)
{
+ struct property *prop;
struct symbol *sym, **sym_arr = NULL;
int i, cnt, size;
regex_t re;
@@ -854,9 +855,15 @@ struct symbol **sym_re_search(const char *pattern)
return NULL;

for_all_symbols(i, sym) {
+ bool found = false;
if (sym->flags & SYMBOL_CONST || !sym->name)
continue;
- if (regexec(&re, sym->name, 0, NULL, 0))
+ if (!regexec(&re, sym->name, 0, NULL, 0))
+ found = true;
+ for_all_prompts(sym, prop)
+ if (!regexec(&re, prop->text, 0, NULL, 0))
+ found = true;
+ if (!found)
continue;
if (cnt + 1 >= size) {
void *tmp = sym_arr;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Nir Tzachar on
On Fri, Aug 6, 2010 at 4:54 PM, Sam Ravnborg <sam(a)ravnborg.org> wrote:
>> >>
>> >> Searching: pressing '/' triggers search mode. nconfig performs a
>> >> � � � � � �regular string compare, case insensitive, starting at
>> >
>> > I would say: simple string compare
>> > "regular" has no meaning (at least for me) there.
>
> pressing '/' triggers interactive search mode. nconfig search for the
> string in the menu prompts (no regex support).
>
> [Just a suggestion for a bt different wording]
>
>> > Maybe I should just stick to config symbol searches. �I don't think it's all
>> > that likely that people will know how each menu line text begins.
>> >
>> >
>>
>> We can replace strcasecmp with strcasestr. I agree it would be more useful.
>
> This is better.
>
>>
>> > As for the search UI, I'd rather that it be presented like the symbol search,
>> > in a box, instead of just a single line at the top of the screen.
>>
>> But then it is not interactive. I was aiming for something similar to
>> vim's search, where the search is matched as you type and the only
>> free terminal real-estate to display the match string was at the top
>> of the screen. I think such a minimal design is better than a
>> cumbersome text box which displays the search results afterwards (as
>> is symbol search), as the search is only intended for the currently
>> displayed menu and the user would usually just want to save the extra
>> typing of navigating to a specific menu item.
>
> It was introduced to replace the "hotkey" support, and as such is useful.
> If we want to search for content of all prompts then we should extend
> the symbols search to do so.
> Maybe we should just let it search for both symbols _and_ propmts.

There is a different alternative which slipped my mind, which can be
useful for Randy's use case: just use the single menu mode of nconfig
and then the search feature will give you the behavior you desire
(i.e., jumping to the globally matching prompt).

> If one search for HOTPLUG_CPU there is no hits in any propmts anyway.
> And if one search for "Pentium" there is no config symbol hits.

If such a search cannot return the menu context of the matching
symbol, there is no way for nconfig to jump to the matching menu. But
a different approach may be to add the symbol search to nconfig's
search, such that instead of just matching the prompt, nconfig will
also match the symbol.

Cheers,
Nir.

> � � � �Sam
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Sam Ravnborg on
On Sun, Aug 08, 2010 at 04:50:06PM +0300, nir.tzachar(a)gmail.com wrote:
> From: Nir Tzachar <nir.tzachar(a)gmail.com>
>
> Remove the old hotkeys feature, and replace it by an interactive string
> search.
> >From nconfig help:
>
> Searching: pressing '/' triggers interactive search mode.
> nconfig performs a case insensitive search for the string
> in the menu prompts (no regex support).
> Pressing the up/down keys highlights the previous/next
> matching item. Backspace removes one character from the
> match string. Pressing either '/' again or ESC exits
> search mode. All other keys behave normally.
>
> Miscellaneous other changes (including Rundy's and Justin's input).
>
> Signed-off-by: Nir Tzachar <nir.tzachar(a)gmail.com>

I like this search mode much better than the hotkey stuff.
And with the new key assignments things works almost as I would expect.

I am not sure if I prefer "space" to bind to usual
function or that it can be used to enter a whitespace.

And getting rid of the capitalization was good!

Acked-by: Sam Ravnborg <sam(a)ravnborg.org>

Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/