From b82dadc1a80f4b8abe8d56d0f88615efb23b69d6 Mon Sep 17 00:00:00 2001 From: rupa Date: Sun, 3 Mar 2013 09:47:02 -0500 Subject: [PATCH] Be explicit that -c matches should start with cwd, not just contain it. --- z.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/z.sh b/z.sh index c54872e..705e428 100755 --- a/z.sh +++ b/z.sh @@ -103,7 +103,7 @@ _z() { while [ "$1" ]; do case "$1" in --) while [ "$1" ]; do shift; local fnd="$fnd $1";done;; -*) local opt=${1:1}; while [ "$opt" ]; do case ${opt:0:1} in - c) local fnd="$PWD $fnd";; + c) local fnd="^$PWD $fnd";; h) echo "${_Z_CMD:-z} [-chlrt] args" >&2; return;; l) local list=1;; r) local typ="rank";; @@ -111,7 +111,7 @@ _z() { esac; opt=${opt:1}; done;; *) local fnd="$fnd $1";; esac; local last=$1; shift; done - [ "$fnd" -a "$fnd" != "$PWD " ] || local list=1 + [ "$fnd" -a "$fnd" != "^$PWD " ] || local list=1 # if we hit enter on a completion just go there case "$last" in