Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: bindkey <whatever> history-beginning-search-backwards; echo $widgts = crash



On 2007-05-22 at 05:32 +0200, Maddi Kopfermann wrote:
> Am Montag, dem 21. Mai 2007 um 18:46 Uhr, Phil Pennock:
> > 
> > history-beginning-search-backwards is not a standard widget; aside from
> > this bug, you need to find which widget you really want.
> 
> zsh -fc "bindkey '^o' history-beginning-backward && echo $widgets"
> 
> crashes the shell
> 
> zsh -fc "bindkey '^o' history-beginning-backwards && echo $widgets"
> 
> crashes the shell
> 
> zsh -fc "bindkey '^o' history-beginning-forward && echo $widgets"
> 
> crashes the shell
> 
> zsh -fc "bindkey '^o' history-beginning-<TAB> && echo $widgets"
> crashes the shell
> 
> the attempt to let completion work crashes the shell.
> > This is a bug when there is no widget with the supplied name;
> 
> Sadly not only in that case!

But, uhm, those aren't widgets; see zshzle(1) for details.
history-beginning-<TAB> would take you as far as
history-beginning-search- but that's not a complete widget, there are
four different widgets with that prefix.  Well, okay, you might be set
up to tab-complete further.  But not in zsh -fc "cmd..." -- if someone
has completion set up to correctly work recursively there, I'd like to
know the settings.

history-search-forward ?  history-beginning-search-forward ?  And also
"-backward".

Meanwhile,
% zsh -fc "cmdname"
will execute cmdname in a non-interactive shell and without any startup
files you might have; but the variables inside that need escaping so
that they'll be expanded by the non-interactive shell.  I think you
want:

% zsh -fc 'bindkey "^o" history-beginning-search-forward; echo $widgets'

And FWIW the supplied patch does prevent this crashing when given a bad
name.



Messages sorted by: Reverse Date, Date, Thread, Author