fix: fix offset bug w/ col_offset and many color blocks

This commit is contained in:
Angelo Fallaria 2022-02-03 18:08:25 +08:00
parent ccd5d9f526
commit 8a975dc9f8

View file

@ -3985,18 +3985,21 @@ get_cols() {
[[ "$blocks" ]] && cols+="${block_spaces// /${blocks}nl}"
[[ "$blocks2" ]] && cols+="${block_spaces// /${blocks2}nl}"
# Determine the horizontal offset of the blocks.
case $col_offset in
"auto") block_offset="$text_padding" ;;
*) block_offset="$col_offset" ;;
esac
# Add newlines to the string.
cols=${cols%%nl}
cols=${cols//nl/
[${text_padding}C${zws}}
[${block_offset}C${zws}}
# Add block height to info height.
((info_height+=block_range[1]>7?block_height+2:block_height+1))
case $col_offset in
"auto") printf '\n\e[%bC%b\n' "$text_padding" "${zws}${cols}" ;;
*) printf '\n\e[%bC%b\n' "$col_offset" "${zws}${cols}" ;;
esac
printf '\n\e[%bC%b\n' "$block_offset" "${zws}${cols}"
fi
unset -v blocks blocks2 cols