From 7dc9e82d8a13fc75f12ea27efc79c2b69f5d4034 Mon Sep 17 00:00:00 2001 From: Thomas DEBESSE Date: Fri, 3 Aug 2012 21:29:59 +0200 Subject: [PATCH] bugfix: do not use 158 if not set, defaults to 80 --- liquidprompt.bash | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/liquidprompt.bash b/liquidprompt.bash index 731c6fc..475b9df 100755 --- a/liquidprompt.bash +++ b/liquidprompt.bash @@ -293,7 +293,14 @@ __shorten_path() local p=$(echo "$1" | sed -e "s|$HOME|~|") 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}" if [[ "$len" -gt "$max_len" ]]