zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] insert-files: Quote all filenames
@ 2017-06-11 10:47 Wieland Hoffmann
  0 siblings, 0 replies; only message in thread
From: Wieland Hoffmann @ 2017-06-11 10:47 UTC (permalink / raw)
  To: zsh-workers; +Cc: Wieland Hoffmann

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-11 10:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-11 10:47 [PATCH] insert-files: Quote all filenames Wieland Hoffmann

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).