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

Re: [PATCH] edit-command-line breaks arguments with spaces



Phil Pennock wrote on Sat, 14 Oct 2017 00:21 -0400:
> On 2017-10-14 at 01:52 +0000, Daniel Shahaf wrote:
> > If $EDITOR is set to "vim -c ''", then:
> > 
> > - current master passes «''» (two characters) for vim's argv[2]
> > 
> > - using eval passes the empty string for vim's argv[2]
> > 
> > - using ${(Q)} elides the "" entirely
> 
> No, the (Q) has nothing to do with it.  The problem is that in zsh,
> expanding an unquoted array variable omits empty elements.
> 
> So instead of «$editor» it needs to be «"${editor[@]}"» or
> «"${(@)editor}"» to keep the empty elements present at _expansion_ time.

Good point; changing «${(Q)foo}» to «"${(@Q)foo}"» and «$editor» to «"${editor[@]}"»
would also work: the problem wasn't (Q) per se, but the lack of (@).

Between eval and (@Q) I think I'm leaning towards the latter.

Thanks Phil.

Cheers,

Daniel



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