From cee0887f77fc13a684da2cc5c18879f9c7afba8e Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Mon, 31 Mar 2014 02:15:45 -0700 Subject: [PATCH 1/2] Prevent extraneous shifting --- z.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/z.sh b/z.sh index b2955b0..017435a 100644 --- a/z.sh +++ b/z.sh @@ -113,7 +113,7 @@ _z() { t) local typ="recent";; esac; opt=${opt:1}; done;; *) local fnd="$fnd${fnd:+ }$1";; - esac; local last=$1; shift; done + esac; local last=$1; [ "$2" ] && shift; done [ "$fnd" -a "$fnd" != "^$PWD " ] || local list=1 # if we hit enter on a completion just go there From 722a564ffb710a630f18eb4cdba17fc89a70db63 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Mon, 31 Mar 2014 03:18:03 -0700 Subject: [PATCH 2/2] Fix potential infinite loop --- z.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/z.sh b/z.sh index 017435a..5f19bd9 100644 --- a/z.sh +++ b/z.sh @@ -113,7 +113,7 @@ _z() { t) local typ="recent";; esac; opt=${opt:1}; done;; *) local fnd="$fnd${fnd:+ }$1";; - esac; local last=$1; [ "$2" ] && shift; done + esac; local last=$1; [ "$#" -gt 0 ] && shift; done [ "$fnd" -a "$fnd" != "^$PWD " ] || local list=1 # if we hit enter on a completion just go there