Skip to content

Commit

Permalink
29891: make zle -lL with arguments work
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Stephenson committed Nov 4, 2011
1 parent fdb0098 commit 45faf8f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
7 changes: 6 additions & 1 deletion ChangeLog
@@ -1,3 +1,8 @@
2011-11-04 Peter Stephenson <pws@csr.com>

* 29891: Doc/Zsh/zle.yo, Src/Zle/zle_thingy.c: allow "zle -lL"
with arguments to list in -L format.

2011-10-31 Peter Stephenson <pws@csr.com>

* Jun T: 29883: Src/Builtins/rlimits.c, Src/Modules/zftp.c: cast
Expand Down Expand Up @@ -15533,5 +15538,5 @@

*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.5491 $
* $Revision: 1.5492 $
*****************************************************
15 changes: 10 additions & 5 deletions Doc/Zsh/zle.yo
Expand Up @@ -392,11 +392,16 @@ commands to create the widgets.
When combined with the tt(-a) option, all widget names are listed,
including the builtin ones. In this case the tt(-L) option is ignored.

If at least one var(string) is given, nothing will be printed but the
return status will be zero if all var(string)s are names of existing
widgets (or of user-defined widgets if the tt(-a) flag is not given)
and non-zero if at least one var(string) is not a name of an defined
widget.
If at least one var(string) is given, and tt(-a) is present or tt(-L) is
not used, nothing will be printed. The return status will be zero if
all var(string)s are names of existing widgets and non-zero if at least one
var(string) is not a name of a defined widget. If tt(-a) is also
present, all widget names are used for the comparison including builtin
widgets, else only user-defined widgets are used.

If at least one var(string) is present and the tt(-L) option is used,
user-defined widgets matching any var(string) are listed in the form of
tt(zle) commands to create the widgets.
)
item(tt(-D) var(widget) ...)(
Delete the named var(widget)s.
Expand Down
12 changes: 11 additions & 1 deletion Src/Zle/zle_thingy.c
Expand Up @@ -394,9 +394,13 @@ bin_zle_list(UNUSED(char *name), char **args, Options ops, UNUSED(char func))
Thingy t;

for (; *args && !ret; args++) {
if (!(t = (Thingy) thingytab->getnode2(thingytab, *args)) ||
HashNode hn = thingytab->getnode2(thingytab, *args);
if (!(t = (Thingy) hn) ||
(!OPT_ISSET(ops,'a') && (t->widget->flags & WIDGET_INT)))
ret = 1;
else if (OPT_ISSET(ops,'L')) {
scanlistwidgets(hn, 1);
}
}
return ret;
}
Expand Down Expand Up @@ -483,6 +487,12 @@ bin_zle_keymap(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
return selectkeymap(*args, 0);
}

/*
* List a widget.
* If list is negative, just print the name.
* If list is 0, use abbreviated format.
* If list is positive, output as a command.
*/
/**/
static void
scanlistwidgets(HashNode hn, int list)
Expand Down

0 comments on commit 45faf8f

Please sign in to comment.