about summary refs log tree commit diff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-11-17 14:16:32 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-11-17 14:16:32 +0000
commit9e260715c42b8f121cfefed5b4fce145194d6e91 (patch)
tree62fc03bf8d66b5de892be6b9b4ad652d57e0a17d /Completion/Unix/Command
parent76e087f4b29ac04afb07e3d655891ee6c10f6145 (diff)
downloadzsh-9e260715c42b8f121cfefed5b4fce145194d6e91.tar.gz
zsh-9e260715c42b8f121cfefed5b4fce145194d6e91.tar.xz
zsh-9e260715c42b8f121cfefed5b4fce145194d6e91.zip
unposted: improvement to whole-path Perforce completion
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/_perforce18
1 files changed, 16 insertions, 2 deletions
diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce
index 672c2299e..d451d7002 100644
--- a/Completion/Unix/Command/_perforce
+++ b/Completion/Unix/Command/_perforce
@@ -1106,8 +1106,22 @@ _perforce_files() {
     # no point trying to look for unmaintained files.  Assume
     # the user knows what they're doing.
     local -a altfiles
+    integer whole_path
 
-    if [[ $PREFIX = //[^/]# ]]; then
+    for type in $types; do
+      _perforce_whole_path $type && whole_path=1
+    done
+
+    # If we're doing whole-path completion, and the user starts
+    # a completion early, assume they want just those files,
+    # rather than a client spec.  This isn't necessarily the case,
+    # but there's an excellent chance it does fit the user's intention
+    # in a case where it's not really worth adding a special option.
+    # A client list can be huge and they're not actually used very
+    # often to refer to files.  In fact, this whole completion
+    # probably ought to be optional (you can do it with tags if
+    # you really want).
+    if [[ $PREFIX = //[^/]# && $whole_path -eq 0 ]]; then
       # Complete //clientname spec.  Don't complete non-directories...
       # I don't actually know if they are valid here.
       altfiles+=("clients:Perforce client:_perforce_clients")
@@ -1118,8 +1132,8 @@ _perforce_files() {
 	  ! zstyle -t ":completion:${curcontext}:" all-files; then
 	  for type in $types; do
 	    altfiles+=("$type-files:$type file:_perforce_${type}_files")
-	    _perforce_whole_path $type && nodirs=1
 	  done
+	  (( whole_path )) && nodirs=1
 	else
 	  altfiles+=("depot-files:file in depot:_perforce_depot_files")
 	fi