about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Completion/Base/_arguments13
-rw-r--r--Completion/Core/_message4
2 files changed, 13 insertions, 4 deletions
diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments
index 1e1787b19..a25e8ded1 100644
--- a/Completion/Base/_arguments
+++ b/Completion/Base/_arguments
@@ -628,8 +628,11 @@ if [[ -z "$def" || "$def" = :* ]]; then
       [[ -n "$inrest" ]] && opt=''
     fi
     if [[ -z "$def" ]]; then
-      _message 'no more arguments'
-      noargs=yes
+      if [[ -z "$args$rest" ]]; then
+        noargs='no arguments'
+      else
+        noargs='no more arguments'
+      fi
     fi
   fi
 
@@ -651,6 +654,7 @@ if [[ -z "$def" || "$def" = :* ]]; then
 	for i in ${(s::)prefix[2,-1]%%${tmp[1][2]}*} ${tmp[1][2]}; do
 	  _options[${prefix[1]}$i]=''
 	done
+	noargs=''
 	break
       elif compset -P "$tmp[1]"; then
 
@@ -659,6 +663,7 @@ if [[ -z "$def" || "$def" = :* ]]; then
 
 	def="$dopts[$tmp[1]]"
 	opt=''
+	noargs=''
 	break
       fi
       shift 1 tmp
@@ -675,10 +680,12 @@ if [[ -z "$def" || "$def" = :* ]]; then
 	for i in ${(s::)prefix[2,-1]%%${tmp[1][2]}*} ${tmp[1][2]}; do
 	  _options[${prefix[1]}$i]=''
 	done
+	noargs=''
 	break
       elif compset -P "$tmp[1]"; then
 	def="$odopts[$tmp[1]]"
 	opt=''
+	noargs=''
 	break
       fi
       shift 1 tmp
@@ -914,6 +921,8 @@ while true; do
   break
 done
 
+[[ -n "$noargs" ]] && _message "$noargs"
+
 [[ -n "$aret" ]] && return 300
 
 # Set the return value.
diff --git a/Completion/Core/_message b/Completion/Core/_message
index e36d8b36e..b7cb34ee1 100644
--- a/Completion/Core/_message
+++ b/Completion/Core/_message
@@ -10,8 +10,8 @@ if [[ -n "$format" ]]; then
     compstate[list]=list
     compstate[insert]=''
     compadd -UX "${format//\\%d/$1}" -n ''
+    compstate[force_list]=yes
   else
-    compadd -X "${format//\\%d/$1}" -n ''
+    compadd -X "${format//\\%d/$1}" -n '' && compstate[force_list]=yes
   fi
-  compstate[force_list]=yes
 fi