From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15941 invoked by alias); 14 Oct 2017 01:52:13 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 41885 Received: (qmail 25136 invoked by uid 1010); 14 Oct 2017 01:52:13 -0000 X-Qmail-Scanner-Diagnostics: from out4-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.28):SA:0(-2.6/5.0):. Processed in 4.60165 secs); 14 Oct 2017 01:52:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=cdPiNK 0Yj3eUEGzTIn2rxb4tm7ganhnzHO1CO70j4i4=; b=wg9nTJoIGDGYpqzhmUUoJc THs9gVel8azPexwmtufVGaErn73OpZMGL7vIkBTMpCiTfrI79wQX3EBlUtD5UhL4 l+xsDfEoZaLsKP1kJRUclhQcrmIDkv7PJkHbSx67T+nHM0WuJkllXBnTFShpszj+ iOKTvWOcaodLBLvfMYzq7JfU5FwEEQ5jjKZ0Wsc/qt0zdTiNUMbPi673n2KoeMDF SxzOq18D/jf6smn8mZ0VCmnrTr7BhLO6wQH7CuBEIbBlKv6QbFWiaIAcweUGvn7Z CqqsiYgnrHooe9/HWTHPNDezAquIlmOF2RUNcGgSOOoVyiVI78AtmC7dBHHremNw == DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=cdPiNK 0Yj3eUEGzTIn2rxb4tm7ganhnzHO1CO70j4i4=; b=Gjz3UA1H74YiPu0WFtfRnv NtiZmt4AVS6aV46ifaw8yCEwbm8rddye5DInpve5XuDdM45IfLFMJtdZnoP0XgLs TqToxiACd0VEjvxKczGv9+i6tczbd2Jf3dMJegI4+ZccpHwabQuz7bFbZaJx9LqQ CG+k7mf1Cj50jxGhgo452fs0zHogWOonwXteRV9MGn0oOzqmxMd+05NrWWZoHTSs JfSbqpalaL0VKtftNos9WE3qsgeza2w+9PZG1YaIqCIES+VetCE/imW2cc5AgyZi 6t/9o+3iq2/cnKwToGaLBKfOoQLeovEgbF9tNIGuGNPaPxotvsk4upkbA0cFIXqg == X-ME-Sender: Message-Id: <1507945924.3744661.1138358040.4B6A109D@webmail.messagingengine.com> From: Daniel Shahaf To: zsh-workers@zsh.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-26fdae60 References: <4B40504C-14CC-4EE0-8A53-5CF67C67E37E@gmail.com> <1507939677.3717869.1138301848.03470D9F@webmail.messagingengine.com> <171013175555.ZM12982@torch.brasslantern.com> In-Reply-To: <171013175555.ZM12982@torch.brasslantern.com> Date: Sat, 14 Oct 2017 01:52:04 +0000 Subject: Re: [PATCH] edit-command-line breaks arguments with spaces Bart Schaefer wrote on Fri, 13 Oct 2017 17:55 -0700: > On Oct 14, 12:07am, Daniel Shahaf wrote: > } Subject: Re: [PATCH] edit-command-line breaks arguments with spaces > } > } Marco Hinz wrote on Sat, 14 Oct 2017 01:05 +0200: > } > + eval "${editor[@]} +${#lines}:$((${#lines[-1]} + 1)) $1";; > } > + (*) eval "${editor[@]} $1";; > }=20 > } LGTM, except that $1 should be changed into ${(q)1} due to the eval. >=20 > Wouldn't this work and be preferable to eval? If $EDITOR is set to "vim -c ''", then: - current master passes =C2=AB''=C2=BB (two characters) for vim's argv[2] - using eval passes the empty string for vim's argv[2] - using ${(Q)} elides the "" entirely So this edge case seems to favour eval. Come to think of it, using eval will make $EDITOR subject to alias expansio= ns. > diff --git a/Functions/Zle/edit-command-line b/Functions/Zle/edit-command= -line > index 353f260..f77eb35 100644 > --- a/Functions/Zle/edit-command-line > +++ b/Functions/Zle/edit-command-line > @@ -15,15 +15,15 @@ > (( $+zle_bracketed_paste )) && print -r -n - $zle_bracketed_paste[2] >=20=20 > # Open the editor, placing the cursor at the right place if we know ho= w. > - local editor=3D${${VISUAL:-${EDITOR:-vi}}} > + local editor=3D(${(Q)${(z)${VISUAL:-${EDITOR:-vi}}}}) > case $editor in=20 > (*vim*) > integer byteoffset=3D$(( $#PREBUFFER + $#LBUFFER + 1 )) > - ${=3Deditor} -c "normal! ${byteoffset}go" -- $1;; > + ${editor} -c "normal! ${byteoffset}go" -- $1;;