about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-08-02 16:51:53 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-08-02 16:51:53 +0000
commit8de5876e8eb2af62f69ca03cdbbf11d731aba389 (patch)
tree07bc4856224b2098be0895dce850b252f6c2055d
parent5c37cf24059be606623c94879d1e43e1a1fb84b6 (diff)
downloadzsh-8de5876e8eb2af62f69ca03cdbbf11d731aba389.tar.gz
zsh-8de5876e8eb2af62f69ca03cdbbf11d731aba389.tar.xz
zsh-8de5876e8eb2af62f69ca03cdbbf11d731aba389.zip
zsh-workers:7348
-rw-r--r--Completion/Core/_path_files15
-rw-r--r--Doc/Zsh/compsys.yo10
2 files changed, 8 insertions, 17 deletions
diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files
index 04f4f1db3..9494d5a4a 100644
--- a/Completion/Core/_path_files
+++ b/Completion/Core/_path_files
@@ -25,7 +25,7 @@
 
 local linepath realpath donepath prepath testpath exppath
 local tmp1 tmp2 tmp3 tmp4 i orig pre suf tpre tsuf
-local pats ignore group expl addpfx addsfx remsfx
+local pats haspats=no ignore group expl addpfx addsfx remsfx
 local nm=$compstate[nmatches] menu
 
 typeset -U prepaths exppaths
@@ -82,9 +82,11 @@ while getopts "P:S:qr:R:W:F:J:V:X:f/g:" opt; do
 	 ;;
   /)     sopt="${sopt}/"
          pats=("$pats[@]" '*(-/)')
+	 haspats=yes
 	 ;;
   g)     gopt='-g'
          pats=("$pats[@]" ${=OPTARG})
+	 haspats=yes
 	 ;;
   esac
 done
@@ -259,14 +261,11 @@ for prepath in "$prepaths[@]"; do
       # an attempt to correct a valid directory name. So we just add the
       # original string in such a case so that the command line doesn't 
       # change but other completers still think there are matches.
+      # We do this only if we weren't given a `-g' or `-/' option because
+      # otherwise this would keep `_files' from completing all filenames
+      # if none of the patterns match.
 
-      # Problem:  this seems to stop _files from finding directory
-      # completions if there were no file completions, for
-      # example `_files *(*)' no longer completes subdirectories after
-      # a /.  For now, make this a configuration option, but
-      # probably it needs to be done better.
-
-      if [[ -n "$compconfig[path_keepdir]" && -z "$tpre$tsuf" &&
+      if [[ "$haspats" = no && -z "$tpre$tsuf" &&
 	"$pre" = */ && -z "$suf" ]]; then
         compadd -nQS '' - "$linepath$donepath$orig"
         tmp4=-
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 5a52ca9ad..466e612ed 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -738,7 +738,7 @@ These functions also accept the `tt(-J)', `tt(-V)', `tt(-X)', `tt(-P)',
 `tt(-S)', `tt(-q)', `tt(-r)', and `tt(-R)' options from the
 tt(compadd) builtin.
 
-Finally, the tt(_path_files) function supports three configuration keys.
+Finally, the tt(_path_files) function supports two configuration keys.
 startitem()
 item(tt(path_expand))(
 If this is set to any non-empty string, the partially
@@ -750,14 +750,6 @@ If this is set to a non-empty string, the cursor will be left
 after the first ambiguous pathname component even when menucompletion
 is used.
 )
-item(tt(path_keepdir))(
-If this is set to a non-empty string, then if completion immediately after
-a slash fails, treat the original string as a successful completion.  This
-prevents a valid directory being treated as a candidate for correction.
-However, it has the side effect that a pattern completion, such as
-`tt(files -g *(*))', will no longer try to complete directories in this
-position if there are no file matches.
-)
 enditem()
 )
 item(tt(_parameters))(