only cd to completions if we've actually tab completed them

We decide you've tab completed if the last argument begins with /, and is an
existing directory. This may still cause unexpected behavior if you do that
without tab completing.
This commit is contained in:
rupa committed 2011-07-25 16:46:10 -04:00
1 parent facab80796
commit 79dc3f340f
1 file changed
+2 -1
+2 -1
View File
@@ -98,7 +98,8 @@ _z() {
[ "$fnd" ] || local list=1
# if we hit enter on a completion just go there
[ -d "$last" ] && cd "$last" && return
# completions will always start with /
[ -z "$list" -a -d "$last" -a "${last:0:1}" = "/" ] && cd "$last" && return
# no file yet
[ -f "$datafile" ] || return