54251: complete names containing dot only after ${

This commit is contained in:
Jun-ichi Takimoto
2026-03-30 13:43:20 +09:00
parent 50bfeb4e98
commit ec5c130abd
2 changed files with 13 additions and 4 deletions

View File

@@ -1,3 +1,8 @@
2026-03-30 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
* 54251: Completion/Zsh/Type/_parameters: complete names with
dot (such as .namespace.param) only after ${
2026-03-26 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
* Stéphane Blondon: 54246: Completion/Zsh/Function/_zcalc:

View File

@@ -10,15 +10,19 @@ local i pfilt
local -i nm=$compstate[nmatches]
local -a expl pattern=( -g \* ) normal described verbose faked fakes tmp
# parameter names that match the pattern $pfilt are removed
zstyle -t ":completion:${curcontext}:parameters" prefix-needed &&
[[ $PREFIX != [_.]* ]] &&
pfilt='[^_.]'
pfilt='[_.]*'
# names containing a dot are allowed only within ${ }
[[ $IPREFIX != \${* ]] && pfilt+='|*.*'
_description parameters expl parameter
zparseopts -D -K -E g:=pattern
if zstyle -t ":completion:${curcontext}:parameters" extra-verbose; then
described=(
"${(@M)${(@k)parameters[(R)$~pattern[2]~*(hideval|local|special)*]}:#$~pfilt*}"
${(k)parameters[(R)$~pattern[2]~*(hideval|local|special)*]:#$~pfilt}
)
compadd "$@" "$expl[@]" -D described -a - described
if (( $#described )); then
@@ -33,10 +37,10 @@ if zstyle -t ":completion:${curcontext}:parameters" extra-verbose; then
fi
normal=(
"${(@M)${(@k)parameters[(R)$~pattern[2]~^(*(hideval|special)*)~*local*]}:#$~pfilt*}"
${(k)parameters[(R)$~pattern[2]~^(*(hideval|special)*)~*local*]:#$~pfilt}
)
else
normal=( "${(@M)${(@k)parameters[(R)$~pattern[2]~*local*]}:#$~pfilt*}" )
normal=( ${(k)parameters[(R)${~pattern[2]}~*local*]:#$~pfilt} )
fi
if zstyle -a ":completion:${curcontext}:" fake-parameters tmp; then