From 2bd3e0f67ee8c4f78cbcf20b6c5c391650ebf5c8 Mon Sep 17 00:00:00 2001 From: Christo Kotze Date: Thu, 22 Feb 2018 22:33:43 +0400 Subject: [PATCH] Fixed silly coding error Did `local 3=...` instead of `3=...` --- functions/utilities.zsh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/functions/utilities.zsh b/functions/utilities.zsh index 1b2035ac..b4173b99 100644 --- a/functions/utilities.zsh +++ b/functions/utilities.zsh @@ -226,7 +226,7 @@ function truncatePath() { # convert $2 from string to integer 2=$(( $2 )) # set $3 to "" if not defined - [[ -z $3 ]] && local 3="" || 3=$(echo -n $3) + [[ -z $3 ]] && 3="" || 3=$(echo -n $3) # set $4 to "right" if not defined [[ -z $4 ]] && 4="right" # create a variable for the truncated path. @@ -237,14 +237,12 @@ function truncatePath() { local paths=$1 paths=(${(s:/:)${paths//"~\/"/}}) # declare locals for the directory being tested and its length - local test_dir test_dir_length delim_len + local test_dir test_dir_length # do the needed truncation case $4 in right) - # check the length of the delimiter - [[ -z $3 ]] && delim_len=${#3} || delim_len=0 # include the delimiter length in the threshhold - local threshhold=$(( $2 + $delim_len )) + local threshhold=$(( $2 + ${#3} )) # loop through the paths for (( i=1; i<${#paths}; i++ )); do # get the current directory value