summaryrefslogtreecommitdiffstats
path: root/Completion
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-08-14 19:30:31 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-08-14 19:30:31 +0000
commitb7d9ff9d3bf71b0f087071895df047946132c784 (patch)
tree82904a92e1d2c891a2bd640c9e4d8024f38e3356 /Completion
parent22608: improve doc for match-word-context (diff)
downloadzsh-b7d9ff9d3bf71b0f087071895df047946132c784.tar
zsh-b7d9ff9d3bf71b0f087071895df047946132c784.tar.gz
zsh-b7d9ff9d3bf71b0f087071895df047946132c784.tar.bz2
zsh-b7d9ff9d3bf71b0f087071895df047946132c784.tar.lz
zsh-b7d9ff9d3bf71b0f087071895df047946132c784.tar.xz
zsh-b7d9ff9d3bf71b0f087071895df047946132c784.tar.zst
zsh-b7d9ff9d3bf71b0f087071895df047946132c784.zip
22601: need some unquoting in _list_files
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Type/_list_files13
1 files changed, 8 insertions, 5 deletions
diff --git a/Completion/Unix/Type/_list_files b/Completion/Unix/Type/_list_files
index bd5c1fa62..5e745d9d1 100644
--- a/Completion/Unix/Type/_list_files
+++ b/Completion/Unix/Type/_list_files
@@ -8,7 +8,7 @@
# Sets array listfiles to the display strings and the array
# listopts appropriately to be added to the compadd command line.
-local stat f elt what
+local stat f elt what dir
local -a stylevals
integer ok
@@ -48,14 +48,17 @@ done
zmodload -i zsh/stat 2>/dev/null || return 1
-for f in ${(P)1}; do
- if [[ ! -e "${2:+$2/}$f" ]]; then
- listfiles+=("${2:+$2/}$f")
+dir=${2:+$2/}
+dir=${(Q)dir}
+
+for f in ${(PQ)1}; do
+ if [[ ! -e "$dir$f" ]]; then
+ listfiles+=("$dir$f")
continue
fi
# Borrowed from Functions/Example/zls
- stat -s -H stat -F "%b %e %H:%M" - "${2:+$2/}$f" >/dev/null 2>&1
+ stat -s -H stat -F "%b %e %H:%M" - "$dir$f" >/dev/null 2>&1
listfiles+=("$stat[mode] ${(l:3:)stat[nlink]} ${(r:8:)stat[uid]} \
${(r:8:)stat[gid]} ${(l:8:)stat[size]} $stat[mtime] $f")