summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Base/_argument_sets4
-rw-r--r--Completion/Base/_arguments5
-rw-r--r--Src/Zle/computil.c2
4 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 9ce330496..268df40d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2000-05-11  Sven Wischnowsky  <wischnow@zsh.org>
 
+	* 11324: Completion/Base/_argument_sets, Completion/Base/_arguments,
+ 	Src/Zle/computil.c: make _argument_sets add the options as
+ 	defaults when there is nothing else to complete
+	
 	* 11321: Completion/Core/_files: _files used alternative tag-order
  	values even if not needed
 	
diff --git a/Completion/Base/_argument_sets b/Completion/Base/_argument_sets
index d9c771051..f8a55dad9 100644
--- a/Completion/Base/_argument_sets
+++ b/Completion/Base/_argument_sets
@@ -59,6 +59,10 @@ while true; do
 done
 
 [[ -n "$_ms_opt" ]] &&
+   { ! zstyle -T ":completion:${curcontext}:options" prefix-needed ||
+     [[ "$PREFIX" = [-+]* ||
+     ( -z "$has_args" && ret -ne 300 && nm -eq compstate[nmatches] ) ]] } &&
+  has_args=yes &&
   _describe -o option \
             _ms_soptmid _ms_soptmidadd -Q -S '' -- \
 	    _ms_soptend -Q -- \
diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments
index ed7bd98d7..e12dca47d 100644
--- a/Completion/Base/_arguments
+++ b/Completion/Base/_arguments
@@ -287,9 +287,10 @@ if (( $# )) && comparguments "$multi[@]" "$autod" "$@"; then
       done
 
       if [[ -z "$matched$hasopts" ]] && _requested options &&
-          { ! zstyle -T ":completion:${curcontext}:options" prefix-needed ||
+          { [[ -n "$ismulti" ]] ||
+            ! zstyle -T ":completion:${curcontext}:options" prefix-needed ||
             [[ "$origpre" = [-+]* ||
-            ( -z "$aret$mesg" && nm -eq compstate[nmatches] ) ]] } ; then
+               ( -z "$aret$mesg" && nm -eq compstate[nmatches] ) ]] } ; then
 	local prevpre="$PREFIX" previpre="$IPREFIX"
 
 	hasopts=yes
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index c47914db7..483823798 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -1339,7 +1339,7 @@ ca_parse_line(Cadef d, int multi)
 		state.nargbeg = cur - 1;
 		state.argend = argend;
 	    }
-	    if (!d->args && !d->rest && *line != '-' && *line != '+')
+	    if (!d->args && !d->rest && *line && *line != '-' && *line != '+')
 		return 1;
 	    if ((adef = state.def = ca_get_arg(d, state.nth)) &&
 		(state.def->type == CAA_RREST ||