Rewrite calcWidth()
This commit is contained in:
parent
fc473c031a
commit
2cd54829d3
10
install.sh
10
install.sh
|
@ -354,16 +354,16 @@ calcAndRun() {
|
||||||
|
|
||||||
calcWidth() {
|
calcWidth() {
|
||||||
str=$1; count=1; found=false; option=1
|
str=$1; count=1; found=false; option=1
|
||||||
for (( i = 0; i < ${#str}; i++ )); do
|
while IFS= read -r -N 1 c; do
|
||||||
if [ "${str:$i:1}" = "\\" ] && [ "${str:$((i+1)):1}" = "n" ]; then
|
if [[ "$c" == $'\n' ]]; then
|
||||||
[ $count -ge $option ] && option=$count
|
[ $count -ge $option ] && option=$count
|
||||||
found=true
|
found=true
|
||||||
count=-1
|
count=-1
|
||||||
fi
|
fi
|
||||||
((count++))
|
((count++))
|
||||||
done
|
done < <(echo -ne "$str")
|
||||||
[ $option -ge "$count" ] && count=option
|
[ $option -ge $count ] && count=option
|
||||||
echo $((count+3))
|
echo $((count+4))
|
||||||
}
|
}
|
||||||
|
|
||||||
calcHeight() {
|
calcHeight() {
|
||||||
|
|
Loading…
Reference in New Issue