Skip to content

Commit

Permalink
[PR] dylanaraps#2042 from angelofallars - BUGFIX: fix offset bug w/ c…
Browse files Browse the repository at this point in the history
…ol_offset and many color blocks dylanaraps#2037

Upstream PR: dylanaraps#2042
Thanks to @angelofallars

Co-authored-by: Angelo Fallaria <ba.fallaria@gmail.com>
  • Loading branch information
hykilpikonna and angelofallars committed Jul 31, 2022
2 parents 759373b + 8a975dc commit 3ff1e38
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions neofetch
Original file line number Diff line number Diff line change
Expand Up @@ -4086,18 +4086,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
Expand Down

0 comments on commit 3ff1e38

Please sign in to comment.