1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-11 20:31:11 +01:00

make _path_files use glob qualifiers from the line when doing pattern matching (11635)

This commit is contained in:
Sven Wischnowsky 2000-05-29 13:11:59 +00:00
parent fb9ec18e9a
commit acd0558e54
2 changed files with 26 additions and 0 deletions

View file

@ -1,5 +1,8 @@
2000-05-29 Sven Wischnowsky <wischnow@zsh.org>
* 11635: Completion/Core/_path_files: make _path_files use glob
qualifiers from the line when doing pattern matching
* users/3101: Doc/Zsh/compsys.yo: make handling of default tag clearer
in the docs

View file

@ -147,6 +147,29 @@ zstyle -s ":completion:${curcontext}:paths" special-dirs sdirs &&
zstyle -s ":completion:${curcontext}:files" ignore-parents ignpar
if [[ -n "$compstate[pattern_match]" &&
( ( -z "$SUFFIX" && "$PREFIX" = *\([^\|\~]##\) ) ||
"$SUFFIX" = *\([^\|\~]##\) ) ]]; then
if [[ "$SUFFIX" = *\([^\|\~]##\) ]]; then
tmp3="${${(M)SUFFIX%\([^\|\~]##\)}[2,-2]}"
SUFFIX="${SUFFIX%\($tmp3\)}"
else
tmp3="${${(M)PREFIX%\([^\|\~]##\)}[2,-2]}"
PREFIX="${PREFIX%\($tmp3\)}"
fi
tmp2=()
for tmp1 in "$pats[@]"; do
if [[ "$tmp1" = (#b)(?*)(\(\([^\|~]##\)\)) ]]; then
tmp2=( "$tmp2[@]" "${match[1]}((${tmp3}${match[2][3,-1]}" )
elif [[ "$tmp1" = (#b)(?*)(\([^\|~]##\)) ]]; then
tmp2=( "$tmp2[@]" "${match[1]}(${tmp3}${match[2][2,-1]}" )
else
tmp2=( "$tmp2[@]" "${tmp1}(${tmp3})" )
fi
done
pats=( "$tmp2[@]" )
fi
# We get the prefix and the suffix from the line and save the whole
# original string. Then we see if we will do menucompletion.