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

Re: History expansion surprisingly sets event designator



Peter Stephenson <p.stephenson@xxxxxxxxxxx> writes:

> On Tue, 6 Jun 2017 17:50:03 +0200
> Leah Neukirchen <leah@xxxxxxxx> wrote:
>
>> Hi,
>> 
>> on #zsh we discovered:
>> 
>> zsh 5.3.1 (x86_64-unknown-linux-gnu)
>> zsh-5.3.1-0-g06b1b7a    (and zsh-5.3.1-204-g62c4169, via danielsh)
>> % zsh -f
>> juno% printf a b c
>> a%
>> juno% echo x y z
>> x y z
>> juno% echo !printf:2<TAB><DEL>!:3<RET>
>> c
>>
>> The first tab expansion will correctly expand to "b", but it changes
>> the event designator to the printf-line, resulting in !:3 expanding to "c",
>> while the typed in line "echo !:3" itself would refer to the previous
>> line, the echo-line, and should result in "z".
>> (Same for tab-expanding the second history reference.)
>> 
>> Pressing ^U will not reset this, but pressing ^C will.
>
> Yes, that's how it works.  I haven't understood why you think it's a
> problem but I presume you're used to some other shell.

If my command line is "echo !:3" before pressing RET, it should always
print z, even if I fiddled around with tab expansion during editing.
I think this is quite confusing as-is.

-- 
Leah Neukirchen  <leah@xxxxxxxx>  http://leah.zone



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