Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Correction oddity



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@xxxxxxxxxxxxxxxxxxxxxxxx>
Work: pws@xxxxxxx
Web: http://www.pwstephenson.fsnet.co.uk



Messages sorted by: Reverse Date, Date, Thread, Author