zpm-zsh / autoenv

Autoenv for zsh
GNU General Public License v3.0
165 stars 23 forks source link

autoenv blocks when entering a subdirectory #15

Closed ithinuel closed 6 years ago

ithinuel commented 6 years ago

how to reproduce

case 1

# new shell is ok
cd Documents
# cd never returns

case 2

# new shell is ok
cd /usr
# everything is ok
cd include
# cd never returns

Hint

I have added

and this is what is reported :

in  /usr/
in  /usr//
in  /usr///usr
in  /usr///usr/usr
in  /usr///usr/usr/usr
in  /usr///usr/usr/usr/usr
in  /usr///usr/usr/usr/usr/usr
in  /usr///usr/usr/usr/usr/usr/usr
...
grigorii-horos commented 6 years ago

@ithinuel Very intresting. But, I can't reproduce this https://asciinema.org/a/Yah4tHSdTCoBzpiW2z3uwUYty

ithinuel commented 6 years ago

I will probably try to play with the IFS var to handle paths as array.

join_path() { local IFS=/; echo "$*" }                                                                                                      
split_path() { local IFS=/; echo "$*" } # this does not break spaces in names. 
a=($(split_path 'ab cd/e/f/')) 
b=($(split_path '//gh i///j/k'))

echo $#a[@] $a[1]
join_path $a $b

results in :

4 ab cd
ab cd/e/f/gh i/j/k

I'll PR once it's fixed.