1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-05-06 07:36:20 +02:00

52768: Handle completer filenames with funny characters in them

For example, a file called _foo;bar will cause this to happen:
% hello [press tab]zsh: command not found: _foo
zsh: command not found: bar
This commit is contained in:
Mikael Magnusson 2024-03-18 15:59:43 +01:00
parent 017738cd60
commit b727b74fe2
3 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2024-03-23 Mikael Magnusson <mikachu@gmail.com>
* 52768: Completion/compdump, Completion/compinit: Handle
completer filenames with funny characters in them
2024-03-21 Peter Stephenson <p.stephenson@samsung.com>
* 52780: Src/Modules/hlgroup.c: remove unnecessary returns.

View File

@ -113,7 +113,7 @@ integer _i=5
print -n autoload -Uz >& $_d_fd
while (( $#_d_als )); do
if (( ! $+_compautos[$_d_als[1]] )); then
print -n " $_d_als[1]"
print -rn " ${(q-)_d_als[1]}"
if (( ! --_i && $#_d_als > 1 )); then
_i=5
print -n ' \\\n '
@ -126,13 +126,13 @@ print >& $_d_fd
local _c
for _c in "${(ok@)_compautos}"; do
print "autoload -Uz $_compautos[$_c] $_c" >& $_d_fd
print -r "autoload -Uz ${(q-)_compautos[$_c]} $_c" >& $_d_fd
done
print >& $_d_fd
print "typeset -gUa _comp_assocs" >& $_d_fd
print "_comp_assocs=( ${(qq)_comp_assocs} )" >& $_d_fd
print -r "_comp_assocs=( ${(qq)_comp_assocs} )" >& $_d_fd
exec {_d_fd}>&-
mv -f $_d_file ${_d_file%.$HOST.$$}

View File

@ -301,7 +301,7 @@ compdef() {
if [[ -z "$eval" ]] && [[ "$1" = *\=* ]]; then
while (( $# )); do
if [[ "$1" = *\=* ]]; then
cmd="${1%%\=*}"
cmd="${(q)${1%%\=*}}"
svc="${1#*\=}"
func="$_comps[${_services[(r)$svc]:-$svc}]"
[[ -n ${_services[$svc]} ]] &&
@ -412,7 +412,7 @@ compdef() {
svc=
fi
if [[ -z "$new" || -z "${_comps[$1]}" ]]; then
_comps[$cmd]="$func"
_comps[$cmd]="${(q)func}"
[[ -n "$svc" ]] && _services[$cmd]="${1#*\=}"
fi
;;