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

Re: capturing output of !! not working

On Sun, 22 Mar 2015 16:22:35 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Mar 22,  6:35pm, Peter Stephenson wrote:
> }
> } As I've noted in the comment, to get this stuff to work cleanly we need
> } to capture character-by-character input at a level over the history, but
> } we don't have one and there are probably too many levels anyway.  So
> } this will have to do --- it's at least fairly obvious what's going on.
> OK, now we just need to do something similar for this:
> torch% alias '{'=echo
> torch% {bar
> zsh: command not found: echobar
> torch% fc -l
>     1  alias '{'=echo
>     2  {echobar

What appears to be happening here is that because there's no end of word
character after the expanded "{" we run straight onto the "bar" and only
call ihwend() via hwend() after that.  As alias expansion is tied to
word-handling, we only then look at the test that resets the position in
the history line, which is too late.

I'm not sure how to fix this.  Ideally, I think we'd handle not adding
the alias text to history the way we've been doing in other cases by
checking INP_* flags, which is much less hit and miss.  That ought not
to be too difficult, but I haven't really got my mind round the
consequences yet.

Everything else I can think of is a bit of a hack (and surely we'd never
etc. etc.)

> Here's a test, which I have dropped in the previously-unused "W" category
> for "builtin interactive commands and constructs".  If that doesn't seem
> correct, rename to D10history.

Looks fine.  I'll try to expand it when it appears.


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