zsh-workers
 help / color / mirror / code / Atom feed
From: Wieland Hoffmann <themineo@gmail.com>
To: zsh-workers@zsh.org
Cc: Wieland Hoffmann <themineo@gmail.com>
Subject: [PATCH] insert-files: Quote all filenames
Date: Sun, 11 Jun 2017 12:47:30 +0200	[thread overview]
Message-ID: <20170611104730.21977-1-themineo@gmail.com> (raw)

This quotes all filenames so they're not split when passed as arguments to other
commands. Previously, `touch "a {1..4}"` and then doing `insert-files <RET>`
would add 8 separate filenames to the commands line, now it's (as expected) only
4. This works for both an empty pattern (`insert-files <RET>`) and refined
ones (`insert-files *pattern <RET>).
---
 Functions/Zle/insert-files | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Functions/Zle/insert-files b/Functions/Zle/insert-files
index 10f90ed4a..2d13d82d2 100644
--- a/Functions/Zle/insert-files
+++ b/Functions/Zle/insert-files
@@ -12,7 +12,7 @@ setopt nobadpattern
 
 local key str files
 
-files=( *(N) )
+files=( *(N:q) )
 if (( $#files )); then
   zle -R "files: ${str}_" "$files[@]"
 else
@@ -26,7 +26,7 @@ while [[ '#key' -ne '#\\r' && '#key' -ne '#\\n' &&
   else
     str="$str$key"
   fi
-  eval "files=( \${~str}*(N) )"
+  eval "files=( \${~str}*(N:q) )"
   if (( $#files )); then
     zle -R "files: ${str}_" "$files[@]"
   else
-- 
2.13.0


                 reply	other threads:[~2017-06-11 10:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170611104730.21977-1-themineo@gmail.com \
    --to=themineo@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).