about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2003-08-22 10:30:08 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2003-08-22 10:30:08 +0000
commit726b13a3a3f0f514e2d355f3de892e48ac873926 (patch)
tree8e871225b950a1193562c1d0e8cdd79e25824702
parent6bbad942fe9c57ea61655faf583c48898a7bed2d (diff)
downloadzsh-726b13a3a3f0f514e2d355f3de892e48ac873926.tar.gz
zsh-726b13a3a3f0f514e2d355f3de892e48ac873926.tar.xz
zsh-726b13a3a3f0f514e2d355f3de892e48ac873926.zip
18959: improve _perforce global option handling again
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Unix/Command/_perforce9
2 files changed, 13 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 158da09c5..32cdcada7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-08-22  Peter Stephenson  <pws@csr.com>
+
+	* 18959: Completion/Unix/Command/_perforce: improve global
+	option handling again; completing global options themselves
+	was infelicitous.
+
 2003-08-21  Peter Stephenson  <pws@csr.com>
 
 	* 18958: Completion/Unix/Command/_perforce: improved option
diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce
index afadda4af..6891d6ba6 100644
--- a/Completion/Unix/Command/_perforce
+++ b/Completion/Unix/Command/_perforce
@@ -273,8 +273,11 @@ _perforce() {
     # end of the arguments list, anyway.
     for (( i = 2; i < CURRENT; i++ )); do
 	if [[ $words[i] = -[$argopts_pass$argopts_ignore] ]]; then
-	    # word with following argument
-	    if [[ $words[i] = -[$argopts_pass] ]]; then
+	    # word with following argument --- check this
+	    # is less than the current word, else we are completing
+	    # this and shouldn't pass it down
+	    if [[ $(( i + 1 )) -lt $CURRENT && \
+		  $words[i] = -[$argopts_pass] ]]; then
 		_perforce_global_options+=(${words[i,i+1]})
 	    fi
 	    (( i++ ))
@@ -912,6 +915,8 @@ _perforce_groups() {
 _perforce_hosts_ports() {
     if compset -P '*:'; then
 	_ports
+	local expl
+	_wanted ports expl port compadd "$@" 1666
     else
 	# is this -q-able?
 	_hosts -S :