From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20346 invoked by alias); 14 Oct 2017 00:56:01 -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: 41884 Received: (qmail 21614 invoked by uid 1010); 14 Oct 2017 00:56:01 -0000 X-Qmail-Scanner-Diagnostics: from mail-pf0-f193.google.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(209.85.192.193):SA:0(-4.2/5.0):. Processed in 3.469795 secs); 14 Oct 2017 00:56:01 -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=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_SORBS_SPAM,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=hvq1HBh605sWQEfAtmhgCPsosQ1AgkTpDlSfR+2fV/M=; b=nrWJQQlypjI2/1DKt0LZyITpFTDaFFs53R5PErh0OxzoAouhfxItOAKb3k20ELT3oB NtpP5Co3ghq+RPgrGyP0pmsX9SYQgfKKrSrsIJOVNrt+6n4ESZvqf6iMBrCsdl4dKlfd evuTjpYR7TwieelUxT6535vTSSitbDKXFR3nHYV+VbPjeLrWATikxqSYfL4hk3D4QVGf wOvX9DEiZVob0P6FG3CJJyFZ5rZZaw8+XusdM/mWShnbK0TSKPz1xg9gUw1SOyUAMN0t SB0Pbp6Tk4MavB1QzfWfvKdpE1h2/OLNdnX54XvZqGKEeRgBg7s3F1ujFE4Tw21CXT29 b5bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=hvq1HBh605sWQEfAtmhgCPsosQ1AgkTpDlSfR+2fV/M=; b=HcJfX+/pRyWNh/ufh2MbP/VOHLD8fZqpA7pl6fsXtjeiDjyQsy7eL7o8fOB8cVNqk7 VscIh+K6pOAzogRJ9fN0/xLdWydaFSVTA7Hovmv+JcOvfNAaEfK3YsuYuzvxri/PfxuR lF0tKUWJv1mdM269bpdo33l8BeswOLGYNq416nsBVQP3iICjzMsDYyrhPJFFyUDC23Rd fcn937N4/t6NRnYTJwF/FrkiJFlJ3VFENvvAMf1Y1so6bjfjqxQDbSoi7cb+k4jS4B+v yUXx6vvnsSaatmUHQR5KYyOAWSD0o3XlKPDgJiI2bzbT8eh3uvwAx2WhUdyljuLRGXsC EksA== X-Gm-Message-State: AMCzsaXIh/qVW6j/OUw0njsj7KMBZTgnJtlbUSozSbuP8OvEmrgcdx39 xba2M/fu8tVVYQuvVLAPqwxJAZCy X-Google-Smtp-Source: AOwi7QCpAIb2DbCIIwnoXfZ79wWL/EwAE+GTrM8JoKDU+jIWuSduEXEeWlCsDNGWzjpepqKG/paxNQ== X-Received: by 10.99.172.83 with SMTP id z19mr2695091pgn.46.1507942554432; Fri, 13 Oct 2017 17:55:54 -0700 (PDT) From: Bart Schaefer Message-Id: <171013175555.ZM12982@torch.brasslantern.com> Date: Fri, 13 Oct 2017 17:55:55 -0700 In-Reply-To: <1507939677.3717869.1138301848.03470D9F@webmail.messagingengine.com> Comments: In reply to Daniel Shahaf "Re: [PATCH] edit-command-line breaks arguments with spaces" (Oct 14, 12:07am) References: <4B40504C-14CC-4EE0-8A53-5CF67C67E37E@gmail.com> <1507939677.3717869.1138301848.03470D9F@webmail.messagingengine.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: [PATCH] edit-command-line breaks arguments with spaces MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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";; } } LGTM, except that $1 should be changed into ${(q)1} due to the eval. Wouldn't this work and be preferable to eval? 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] # Open the editor, placing the cursor at the right place if we know how. - local editor=${${VISUAL:-${EDITOR:-vi}}} + local editor=(${(Q)${(z)${VISUAL:-${EDITOR:-vi}}}}) case $editor in (*vim*) integer byteoffset=$(( $#PREBUFFER + $#LBUFFER + 1 )) - ${=editor} -c "normal! ${byteoffset}go" -- $1;; + ${editor} -c "normal! ${byteoffset}go" -- $1;; (*emacs*) local lines=( ${(f):-"$PREBUFFER$LBUFFER"} ) - ${=editor} +${#lines}:$((${#lines[-1]} + 1)) $1;; - (*) ${=editor} $1;; + ${editor} +${#lines}:$((${#lines[-1]} + 1)) $1;; + (*) ${editor} $1;; esac (( $+zle_bracketed_paste )) && print -r -n - $zle_bracketed_paste[1] -- Barton E. Schaefer