zsh-workers
 help / color / mirror / code / Atom feed
* Re: extended compctl bug in 3.1.5
@ 1999-06-22 13:31 Sven Wischnowsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 1999-06-22 13:31 UTC (permalink / raw)
  To: zsh-workers; +Cc: Greg Klanderman


Greg Klanderman wrote:

> Hi,
> 
> I hope this example will illustrate two bugs in using the "R" pattern
> in extended completion:
> 
> compctl -k '(foo bar)' -x 'R[bar,foo]' -k '(a b c)' \
>              - 'R[foo,;]' -k '(1 2 3)' -- foobar
> 
> First, type "foobar foo", with no space after "foo" and hit TAB.  You
> get a beep and no completions, because the 'R[foo,;]' clause is
> matching even though you are not after but ON the word with prefix
> 'foo'.  I would expect it to complete "foo" by appending the suffix
> space.

Yes, we should probably avoid this.

> Second, type "foobar foo bar ", with a space after "bar".  Hit TAB and
> you get the completions "a", "b", and "c", which you should not, as
> you are not before "foo".

This, however is intentional -- think about cases where you want to
have multiple groups of `foo ... bar'. But the manual could be
clearer...

I don't know if you can apply this patch to an unmodified 3.1.5.

Bye
 Sven

diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Tue Jun 22 11:51:29 1999
+++ Src/Zle/zle_tricky.c	Tue Jun 22 15:24:27 1999
@@ -5631,7 +5631,7 @@
 		    case CCT_RANGEPAT:
 			if (cc->type == CCT_RANGEPAT)
 			    tokenize(sc = dupstring(cc->u.l.a[i]));
-			for (j = clwpos; j; j--) {
+			for (j = clwpos - 1; j > 0; j--) {
 			    untokenize(s = ztrdup(clwords[j]));
 			    if (cc->type == CCT_RANGESTR)
 				sc = rembslash(cc->u.l.a[i]);
diff -u od/Zsh/compctl.yo Doc/Zsh/compctl.yo
--- od/Zsh/compctl.yo	Tue Jun 22 11:51:38 1999
+++ Doc/Zsh/compctl.yo	Tue Jun 22 15:26:22 1999
@@ -633,7 +633,8 @@
 )
 item(tt(r[)var(str1)tt(,)var(str2)tt(])...)(
 Matches if the cursor is after a word with prefix var(str1).  If there
-is also a word with prefix var(str2) on the command line it matches
+is also a word with prefix var(str2) on the command line after the one 
+matched by var(str1) it matches
 only if the cursor is before this word. If the comma and var(str2) are
 omitted, it matches if the cursor is after a word with prefix var(str1).
 )

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


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

* extended compctl bug in 3.1.5
@ 1999-06-22 13:21 Greg Klanderman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Klanderman @ 1999-06-22 13:21 UTC (permalink / raw)
  To: Zsh list


Hi,

I hope this example will illustrate two bugs in using the "R" pattern
in extended completion:

compctl -k '(foo bar)' -x 'R[bar,foo]' -k '(a b c)' \
             - 'R[foo,;]' -k '(1 2 3)' -- foobar

First, type "foobar foo", with no space after "foo" and hit TAB.  You
get a beep and no completions, because the 'R[foo,;]' clause is
matching even though you are not after but ON the word with prefix
'foo'.  I would expect it to complete "foo" by appending the suffix
space.

Second, type "foobar foo bar ", with a space after "bar".  Hit TAB and
you get the completions "a", "b", and "c", which you should not, as
you are not before "foo".

Please include me in any reply as I am not on the list.

thanks,
Greg


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

end of thread, other threads:[~1999-06-22 13:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-22 13:31 extended compctl bug in 3.1.5 Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
1999-06-22 13:21 Greg Klanderman

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).