Add generic calcHeight()
This commit is contained in:
parent
cf55e4285e
commit
80694b75fc
|
@ -213,23 +213,22 @@ calcWidthDialog() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
calcHeightWhiptail() {
|
calcHeight() {
|
||||||
newlines=$(printf "$1" | grep -c $'\n')
|
newlines=$(printf "$1" | grep -c $'\n')
|
||||||
chars=$(echo "$1" | wc -c)
|
chars=$(echo "$1" | wc -c)
|
||||||
height=$(echo "$chars" "$newlines" | awk '{
|
height=$(echo "$chars" "$newlines" | awk '{
|
||||||
x = (($1 - $2 + ($2 * 60)) / 60)
|
x = (($1 - $2 + ($2 * 60)) / 60)
|
||||||
printf "%d", (x == int(x)) ? x : int(x) + 1
|
printf "%d", (x == int(x)) ? x : int(x) + 1
|
||||||
}')
|
}')
|
||||||
|
}
|
||||||
|
|
||||||
|
calcHeightWhiptail() {
|
||||||
|
calcHeight "$@"
|
||||||
echo $((6+height))
|
echo $((6+height))
|
||||||
}
|
}
|
||||||
|
|
||||||
calcHeightDialog() {
|
calcHeightDialog() {
|
||||||
newlines=$(printf "$1" | grep -c $'\n')
|
calcHeight "$@"
|
||||||
chars=$(echo "$1" | wc -c)
|
|
||||||
height=$(echo "$chars" "$newlines" | awk '{
|
|
||||||
x = (($1 - $2 + ($2 * 60)) / 60)
|
|
||||||
printf "%d", (x == int(x)) ? x : int(x) + 1
|
|
||||||
}')
|
|
||||||
echo $((4+height))
|
echo $((4+height))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue