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

PATCH _cd: completion fails for "cd .." if $PWD/.. contains a space



Hi,

There’s a bug in _cd completion that results in empty result when trying to
complete after “cd ../” if there’s a space somewhere in $PWD/..

Steps to reproduce:
$ mkdir -p "a b/c”
$ cd "a b/c”
$ cd ../<TAB> # Results in `local directory’ and no completion suggestions.

The following patch fixes the space issue, but there may be other cases that
cause the same behavior that aren’t fixed by this change.

diff --git i/Completion/Zsh/Command/_cd w/Completion/Zsh/Command/_cd
index a5d328f..abd4fa0 100644
--- i/Completion/Zsh/Command/_cd
+++ w/Completion/Zsh/Command/_cd
@@ -57,7 +57,7 @@ else
# Use cd in a subshell to properly [not] resolve symlinks
tmpprefix=$(cd ${PREFIX%/*} >&/dev/null && print $PWD)
if [[ -n $tmpprefix ]]; then
- tmpWpath=(-W $tmpprefix)
+ tmpWpath=(-W \"$tmpprefix\")
IPREFIX=${IPREFIX}${PREFIX%/*}/
PREFIX=${PREFIX##*/}
fi

--
Alexey Bezhan



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