1
0
Fork 0

Zsh prompt: Allow to break shrink-path-loop early

This commit is contained in:
tastytea 2022-04-22 23:14:32 +02:00
parent 164ea811ce
commit 1a16e70e08
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
1 changed files with 2 additions and 2 deletions

View File

@ -105,8 +105,8 @@ function _shrunkpwd()
local -a short_dir=(${(s:/:)dir})
local -i allowed_element_width=$(( ${max_width} / ${#short_dir} - 1 ))
for index in {2..$(( ${#short_dir} - 1 ))}; do
if [[ ${#short_dir[index]} -gt ${allowed_element_width} ]] && \
[[ ${#${(j:/:)short_dir}} -gt ${max_width} ]]; then
if [[ ${#short_dir[index]} -gt ${allowed_element_width} ]]; then
[[ ${#${(j:/:)short_dir}} -le ${max_width} ]] && break
short_dir[index]=${short_dir[index][1]}
fi
done