bugfix: do not use 158 if not set, defaults to 80

This commit is contained in:
Thomas DEBESSE 2012-08-03 21:29:59 +02:00 committed by nojhan
parent 65b9e62ab3
commit 7dc9e82d8a

View File

@ -293,7 +293,14 @@ __shorten_path()
local p=$(echo "$1" | sed -e "s|$HOME|~|") local p=$(echo "$1" | sed -e "s|$HOME|~|")
local len="${#p}" local len="${#p}"
local max_len=$(($COLUMNS*$len_percent/100))
if [ -z "$COLUMNS" ]
then
local columns=80
else
local columns=$COLUMNS
fi
local max_len=$(($columns*$len_percent/100))
local mask_len="${#mask}" local mask_len="${#mask}"
if [[ "$len" -gt "$max_len" ]] if [[ "$len" -gt "$max_len" ]]