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

[PATCH] insert-files: Quote all filenames



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



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