Zsh prompt: Allow to break shrink-path-loop early
This commit is contained in:
parent
164ea811ce
commit
1a16e70e08
|
@ -105,8 +105,8 @@ function _shrunkpwd()
|
||||||
local -a short_dir=(${(s:/:)dir})
|
local -a short_dir=(${(s:/:)dir})
|
||||||
local -i allowed_element_width=$(( ${max_width} / ${#short_dir} - 1 ))
|
local -i allowed_element_width=$(( ${max_width} / ${#short_dir} - 1 ))
|
||||||
for index in {2..$(( ${#short_dir} - 1 ))}; do
|
for index in {2..$(( ${#short_dir} - 1 ))}; do
|
||||||
if [[ ${#short_dir[index]} -gt ${allowed_element_width} ]] && \
|
if [[ ${#short_dir[index]} -gt ${allowed_element_width} ]]; then
|
||||||
[[ ${#${(j:/:)short_dir}} -gt ${max_width} ]]; then
|
[[ ${#${(j:/:)short_dir}} -le ${max_width} ]] && break
|
||||||
short_dir[index]=${short_dir[index][1]}
|
short_dir[index]=${short_dir[index][1]}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue
Block a user