zsh-workers
 help / color / mirror / code / Atom feed
* Correction oddity
@ 2001-08-15 23:50 Peter Stephenson
  2001-08-16  0:16 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2001-08-15 23:50 UTC (permalink / raw)
  To: Zsh hackers list

Can anybody (I can think of one possible candidate) explain what's going
on here?  I'm getting it with `appletviewer name<TAB>' (since this will
try to complete URLs and attempt to correct anything you type to the
appropriate form) which is using _java for completion, which is in turn
calling _urls.  This is from a completion debugging trace; I've wrapped
it by hand where the backslash is:

compadd:13:> compadd -M m:{a-zA-Z}={A-Za-z} -M corrections \
-X Completing corrections -M r:|[_-]=* r:|=* -D equal -
compadd:compadd:13: unknown match specification character `c'

Where did that -M before `corrections' come from?  That should be a -J,
I believe.  I've looked at the compadd function defined in _approximate,
the _urls function (we're at line 74,

    while _next_label prefixes expl 'URL prefix' -S '' "$@"; do

which looks innocuous) and thus far am none the wiser.  The matcher list
looks like

zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[.,_-]=** r:|=**'

as you could probably guess.

I can send more detail but it's awfy large and I hope it's reproducible.
-- 
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
Work: pws@csr.com
Web: http://www.pwstephenson.fsnet.co.uk


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

* Re: Correction oddity
  2001-08-15 23:50 Correction oddity Peter Stephenson
@ 2001-08-16  0:16 ` Peter Stephenson
  2001-08-16  8:05   ` PATCH: " Sven Wischnowsky
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2001-08-16  0:16 UTC (permalink / raw)
  To: Zsh hackers list

Peter Stephenson wrote:
> the _urls function (we're at line 74,

Forget that, we've finished _urls.  We're executing this in _arguments:

      compadd -M "$matcher" -D equal - "${(@)equal%%:*}"

The redefined compadd:

  compadd() {
    [[ ${argv[(I)-[a-zA-Z]#U[a-zA-Z]#]} -eq 0 &&
       "${#:-$PREFIX$SUFFIX}" -le _comp_correct ]] && return

    ### This distinction doesn't seem to be needed anymore
    # if [[ "$PREFIX" = \~*/* ]]; then
    #   PREFIX="${PREFIX%%/*}/(#a${_comp_correct})${PREFIX#*/}"
    # else
      PREFIX="(#a${_comp_correct})$PREFIX"
    # fi

    (( $_correct_group )) && _correct_expl[_correct_group]=${argv[(R)-*[JV]]}

    builtin compadd "$_correct_expl[@]" "$@"
  }

finds _correct_group is 3; I presume this is the index of the -J or -V
argument in the compadd command,

  compadd -M m:{a-zA-Z}={A-Za-z} -M corrections \
-X Completing corrections -M r:|[_-]=* r:|=* -D equal -

and indeed it is that `-M' which should be -J or -V.  Unfortunately it
becomes -M because there's no -J or -V in the argument list, and in that
case ${argv[(R)-*[JV]]} returns the first argument --- dunno if that's a
bug, it doesn't seem so hot, but it's presumably not the root bug.
Getting that test to check if the reverse match turned up something
sensible might be a start, but I'm way out of my depth.

-- 
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
Work: pws@csr.com
Web: http://www.pwstephenson.fsnet.co.uk


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

* PATCH: Re: Correction oddity
  2001-08-16  0:16 ` Peter Stephenson
@ 2001-08-16  8:05   ` Sven Wischnowsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 2001-08-16  8:05 UTC (permalink / raw)
  To: zsh-workers


Peter Stephenson wrote:

> ...
> 
> finds _correct_group is 3; I presume this is the index of the -J or -V
> argument in the compadd command,
> 
>   compadd -M m:{a-zA-Z}={A-Za-z} -M corrections \
> -X Completing corrections -M r:|[_-]=* r:|=* -D equal -
> 
> and indeed it is that `-M' which should be -J or -V.  Unfortunately it
> becomes -M because there's no -J or -V in the argument list, and in that
> case ${argv[(R)-*[JV]]} returns the first argument --- dunno if that's a
> bug, it doesn't seem so hot, but it's presumably not the root bug.
> Getting that test to check if the reverse match turned up something
> sensible might be a start, but I'm way out of my depth.

It's really the root bug.  I didn't think of cases where there is no
-[JV] passed to compadd.

Ahem.


Bye
  Sven

Index: Completion/Base/Completer/_approximate
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Completer/_approximate,v
retrieving revision 1.4
diff -u -r1.4 _approximate
--- Completion/Base/Completer/_approximate	2001/08/07 10:38:36	1.4
+++ Completion/Base/Completer/_approximate	2001/08/16 08:03:05
@@ -59,7 +59,8 @@
       PREFIX="(#a${_comp_correct})$PREFIX"
     # fi
 
-    (( $_correct_group )) && _correct_expl[_correct_group]=${argv[(R)-*[JV]]}
+    (( $_correct_group && $argv[(I)-*[JV]] )) &&
+        _correct_expl[_correct_group]=${argv[(R)-*[JV]]}
 
     builtin compadd "$_correct_expl[@]" "$@"
   }

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


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

end of thread, other threads:[~2001-08-16  8:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-15 23:50 Correction oddity Peter Stephenson
2001-08-16  0:16 ` Peter Stephenson
2001-08-16  8:05   ` PATCH: " Sven Wischnowsky

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