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

Re: bug in accept-exact-dirs style



On Jan 27,  6:54pm, Greg Klanderman wrote:
}
} [~] greg@lwm| zsh -f
} lwm% mkdir foo
} lwm% touch foo/bar
} lwm% touch foo/baz
} lwm% autoload -U compinit
} lwm% compinit
} lwm% zstyle ':completion:*' accept-exact-dirs yes
} 
} Now try completing each of the following:
} 
} ls foo/                # OK
} ls ~/foo/              # doesn't work - no completions
} ls /home/greg/foo/     # OK
} ls $HOME/foo/          # doesn't work - no completions

This isn't directly related to accept-exact-dirs ... a prefix that
needs expansion is removed by _path_files in the section between the
comments

# Now let's have a closer look at the string to complete.

  and

# Now we generate the matches. First we loop over all prefix paths given
# with the `-W' option.

The result after removing the prefix eventually ends up in $tmp1, so
when that is a string that will still pass the -d test in this loop:

    while true; do
      if [[ -d $donepath$tmp1 ]]; then
	donepath=$donepath$tmp1/
	pre=$tpre
	break
      elif [[ $tmp1 = (#b)(*)/([^/]#) ]]; then
	tmp1=$match[1]
	tpre=$match[2]/$tpre
      else
	break
      fi
    done

Then the code is fooled into thinking that the suffix is part of the
prefix, and on line 585 the PREFIX string is rebuilt in the wrong order,
becoming "tmp/~/" instead of "~/tmp/".

At that point I get lost, and I've already spent more time than I should
have looking at it.  PWS?  Anyone?



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