Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] insert-files: Quote all filenames
- X-seq: zsh-workers 41265
- From: Wieland Hoffmann <themineo@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] insert-files: Quote all filenames
- Date: Sun, 11 Jun 2017 12:47:30 +0200
- Cc: Wieland Hoffmann <themineo@xxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=VZXnf8UIOWulVGaDEQzVktSLF6F5GXWjxd5CqPzrakY=; b=uaFF9NExT+E+KckeAUeR0vWyeyr/G1tRj1XSewSJ4Hm3z2vdzpsRTEe82jAG1PtXZI 06VPTELeYj34Z8JWcsxhL/yt3d+DQk4F48zbFf+BYloGWeGXdeV5tKM4RM3hbKuR5VlH Lo5LXoT64/49NMPoHgkRPceJZzATDnUC1dsjjU00lUNd3sqzsNfpZxkXHaIMI8THQNrV nBcuVhdzkJFsyVUzvKUdt6QPMeNQoVOB4FZaIPbjYE4c/9svFHChfrFMiSSPy1JPc2SH b1CNEYGqENbp41CVCdp2HFZ3Qlv5Tyt0J0u5+kmIymYuQj/6QUq8WF0zYErxJ68w/f5f XZzA==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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