Zsh: Early return in _shrunkpwd()

This commit is contained in:
tastytea 2022-04-22 08:40:10 +02:00
parent 5e22f6cea1
commit 2e4cfd99e0
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM

View File

@ -95,6 +95,10 @@ function _shrunkpwd()
{
local dir=${(D)PWD}
local -i maxwidth=$(( ${COLUMNS} / 3 ))
if [[ ${#dir} -le ${maxwidth} ]]; then
print -n ${dir}
return
fi
local -a shortdir=(${(s:/:)dir})
for index in {2..${#shortdir}}; do