about summary refs log tree commit diff
diff options
context:
space:
mode:
-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 :