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

39795: preserve "cd -" behavior around directory shuffling in _canonical_paths_pwd

This commit is contained in:
Barton E. Schaefer 2016-10-31 14:57:33 -07:00
parent 59dbab4f1c
commit 0a5aea375d
2 changed files with 6 additions and 1 deletions

View file

@ -1,5 +1,8 @@
2016-10-31 Barton E. Schaefer <schaefer@zsh.org>
* 39795: Completion/Unix/Type/_canonical_paths: preserve "cd -"
behavior around directory shuffling in _canonical_paths_pwd
* 39792: Completion/Unix/Type/_canonical_paths: improve handling
of relative paths in _canonical_paths_add_paths

View file

@ -16,11 +16,13 @@
_canonical_paths_pwd() {
# Get the canonical directory name by changing to it.
integer chaselinks
local oldpwd=$OLDPWD
[[ -o chaselinks ]] && (( chaselinks = 1 ))
setopt localoptions nopushdignoredups chaselinks
setopt localoptions nopushdignoredups chaselinks noautopushd
if builtin pushd -q -- $1 2>/dev/null; then
REPLY=$PWD
(( chaselinks )) || unsetopt chaselinks
[[ -n $oldpwd && -d $oldpwd ]] && builtin cd -q $oldpwd # For "cd -"
builtin popd -q
else
REPLY=$1