adds POWERLEVEL9K_SHORTEN_DELIMITER_LENGTH for truncate_to_unique

This commit is contained in:
Syphdias 2019-05-26 23:35:15 +02:00
parent 6c61fb5c20
commit c581623801
No known key found for this signature in database
GPG key ID: 6F62E6FB3E67F92D

View file

@ -835,8 +835,9 @@ prompt_dir() {
fi
;;
truncate_to_unique)
local -i i=2 n=1
local -i i=2 n=1 d=0
delim=${POWERLEVEL9K_SHORTEN_DELIMITER-'*'}
d=${POWERLEVEL9K_SHORTEN_DELIMITER_LENGTH:-$#POWERLEVEL9K_SHORTEN_DELIMITER}
(( POWERLEVEL9K_SHORTEN_DIR_LENGTH >= 0 )) && n=POWERLEVEL9K_SHORTEN_DIR_LENGTH
local pat=${POWERLEVEL9K_SHORTEN_FOLDER_MARKER-'(.bzr|CVS|.git|.hg|.svn|.citc)'}
local parent="${PWD%/${(pj./.)parts[i,-1]}}"
@ -850,11 +851,11 @@ prompt_dir() {
fi
fi
local -i j=1
for (( ; j + $#delim < $#dir; ++j )); do
for (( ; j + d < $#dir; ++j )); do
local -a matching=($parent/$dir[1,j]*/(N))
(( $#matching == 1 )) && break
done
(( j + $#delim >= $#dir )) || parts[i]=$dir[1,j]$'\0'
(( j + d >= $#dir )) || parts[i]=$dir[1,j]$'\0'
parent+=/$dir
done
;;