about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2011-09-05 22:01:11 +0000
committerBart Schaefer <barts@users.sourceforge.net>2011-09-05 22:01:11 +0000
commit7e528b4985e6cfb44683870f5e837833cf9c765a (patch)
tree4aa2fd52110c2e4afd3737c9637e5d0e4398b877
parent2dbde98c489fe381ba2e75f35d39bc431ecd7f32 (diff)
downloadzsh-7e528b4985e6cfb44683870f5e837833cf9c765a.tar.gz
zsh-7e528b4985e6cfb44683870f5e837833cf9c765a.tar.xz
zsh-7e528b4985e6cfb44683870f5e837833cf9c765a.zip
users/16302: pattern matching for plain files was broken by 29444
-rw-r--r--ChangeLog8
-rw-r--r--Completion/Unix/Type/_path_files15
2 files changed, 20 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 1c2d0d5dd..17d1a8f87 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-09-05  Barton E. Schaefer  <schaefer@brasslantern.com>
+
+	* users/16302: Completion/Unix/Type/_path_files: pattern matching
+	for plain files (e.g., *.pdf for xpdf completion) was broken by
+	29444.  Hopefully this does not re-break directory patterns.
+
 2011-08-30  Simon Ruderich  <simon@ruderich.org>
 
 	* 29745: Mikael Magnusson: Completion/X/Command/_mplayer: fix -ss
@@ -15359,5 +15365,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5452 $
+* $Revision: 1.5453 $
 *****************************************************
diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files
index a8d03efa9..a170983ba 100644
--- a/Completion/Unix/Type/_path_files
+++ b/Completion/Unix/Type/_path_files
@@ -438,8 +438,19 @@ for prepath in "$prepaths[@]"; do
 
     tmp2=( "$tmp1[@]" )
 
-    if [[ "$tpre$tsuf" = (#b)*/(*) && -n "$fake${match[1]}" ]]; then
-      compfiles -P$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" "$sdirs" fake
+    if [[ "$tpre$tsuf" = (#b)*/(*) ]]; then
+
+      # We are going to be looping over the leading path segments.
+      # This means we should not apply special-dirs handling unless
+      # the path tail is a fake directory that needs to be simulated,
+      # and we should not apply pattern matching until we are looking
+      # for files rather than for intermediate directories.
+
+      if [[ -n "$fake${match[1]}" ]]; then
+        compfiles -P$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" "$sdirs" fake
+      else
+        compfiles -P$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" '' fake
+      fi
     elif [[ "$sopt" = *[/f]* ]]; then
       compfiles -p$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" "$sdirs" fake "$pats[@]"
     else