Tweak path algorithm in Zsh prompt
Reduce allowed element width to increase probability of unshortened last element.
This commit is contained in:
parent
cd8244faa4
commit
b252ce4ec5
@ -29,7 +29,7 @@ function prompt_tastytea_shrunkpwd() {
|
||||
|
||||
# Maybe shorten all elements but the first and last
|
||||
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]} - ${#short_dir[-1]} ) / ${#short_dir} ))
|
||||
for index in {2..$(( ${#short_dir} - 1 ))}; do
|
||||
if [[ ${#short_dir[index]} -gt ${allowed_element_width} ]]; then
|
||||
[[ ${#${(j:/:)short_dir}} -le ${max_width} ]] && break
|
||||
|
Loading…
x
Reference in New Issue
Block a user