zsh-workers
 help / color / mirror / code / Atom feed
* Re: completion just after an option by _arguments.
@ 2000-01-31 11:41 Sven Wischnowsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2000-01-31 11:41 UTC (permalink / raw)
  To: zsh-workers


Tanaka Akira wrote:

> I found a problem with _arguments.
> 
> Z:akr@is27e1u11% Src/zsh -f
> is27e1u11% bindkey -e; autoload -U compinit; compinit -D; compdef _tst tst
> is27e1u11% _tst () { _arguments '-x[desc]' }
> is27e1u11% zstyle ':completion*:messages' format '%d'
> is27e1u11% tst -x<TAB>
> no arguments
> 
> It should insert a space.  3.1.6-pws-6 works so.

Whew. This tries to fix it (it had inactivated the option description
after it had found it, the patch basically makes it be activated again 
in such cases).

Note that with `_arguments -s ...' the behaviour is still the same,
but I think thats ok. At least I currently don't see a solution for
that. Hm. maybe some trickery in _arguments...

Bye
 Sven

diff -ru ../z.old/Src/Zle/computil.c Src/Zle/computil.c
--- ../z.old/Src/Zle/computil.c	Mon Jan 31 11:35:54 2000
+++ Src/Zle/computil.c	Mon Jan 31 12:35:05 2000
@@ -1019,7 +1019,7 @@
 ca_parse_line(Cadef d)
 {
     Caarg adef, ddef;
-    Caopt ptr;
+    Caopt ptr, wasopt;
     struct castate state;
     char *line, *pe;
     int cur, doff;
@@ -1107,6 +1107,8 @@
 
 	pe = NULL;
 
+	wasopt = NULL;
+
 	/* See if it's an option. */
 
 	if (state.opt == 2 && (state.curopt = ca_get_opt(d, line, 0, &pe)) &&
@@ -1141,8 +1143,11 @@
 	    }
 	    if (state.def)
 		state.opt = 0;
-	    else
+	    else {
+		if (!d->single || (state.curopt->name[1] && state.curopt->name[2]))
+		    wasopt = state.curopt;
 		state.curopt = NULL;
+	    }
 	} else if (state.opt == 2 && d->single &&
 		   (state.curopt = ca_get_sopt(d, line, 0, &pe))) {
 	    /* Or maybe it's a single-letter option? */
@@ -1262,6 +1267,8 @@
 		ca_laststate.optbeg = state.nargbeg;
 		ca_laststate.argbeg = state.restbeg;
 		ca_laststate.singles = state.singles;
+		if (wasopt)
+		    wasopt->active = 1;
 	    }
 	}
     }

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 2+ messages in thread

* completion just after an option by _arguments.
@ 2000-01-30  3:37 Tanaka Akira
  0 siblings, 0 replies; 2+ messages in thread
From: Tanaka Akira @ 2000-01-30  3:37 UTC (permalink / raw)
  To: zsh-workers

I found a problem with _arguments.

Z:akr@is27e1u11% Src/zsh -f
is27e1u11% bindkey -e; autoload -U compinit; compinit -D; compdef _tst tst
is27e1u11% _tst () { _arguments '-x[desc]' }
is27e1u11% zstyle ':completion*:messages' format '%d'
is27e1u11% tst -x<TAB>
no arguments

It should insert a space.  3.1.6-pws-6 works so.
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-01-31 11:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-31 11:41 completion just after an option by _arguments Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
2000-01-30  3:37 Tanaka Akira

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).