about summary refs log tree commit diff
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
parent6a77c04ce0fd8079ac93aa6f1657b3cc130987bc (diff)
downloadzsh-b7d9ff9d3bf71b0f087071895df047946132c784.tar.gz
zsh-b7d9ff9d3bf71b0f087071895df047946132c784.tar.xz
zsh-b7d9ff9d3bf71b0f087071895df047946132c784.zip
22601: need some unquoting in _list_files
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Type/_list_files13
2 files changed, 13 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index cd86dfb88..269e32943 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,11 @@
 	* 22605: Src/Zle/complist.c: bug in 22597 noticed by Bart
 	when not printing.
 
+2006-08-13  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 22601: Completion/Unix/Type/_list_files: need to unquote
+	characters quoted by the completion mechanism.
+
 2006-08-13  Clint Adams  <clint@zsh.org>
 
 	* unposted: Functions/Zle/.distfiles,
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")