General: Fix prompt height when color blocks are disabled in config
This commit is contained in:
parent
b4e5169aa9
commit
bff259fdd0
15
neofetch
15
neofetch
|
@ -1949,22 +1949,22 @@ get_cols() {
|
||||||
done
|
done
|
||||||
|
|
||||||
# Convert height into spaces.
|
# Convert height into spaces.
|
||||||
printf -v spaces "%${block_height}s"
|
printf -v block_spaces "%${block_height}s"
|
||||||
|
|
||||||
# Convert the spaces into rows of blocks.
|
# Convert the spaces into rows of blocks.
|
||||||
[[ "$blocks" ]] && cols+="${spaces// /${blocks}${reset}nl}"
|
[[ "$blocks" ]] && cols+="${block_spaces// /${blocks}${reset}nl}"
|
||||||
[[ "$blocks2" ]] && cols+="${spaces// /${blocks2}${reset}nl}"
|
[[ "$blocks2" ]] && cols+="${block_spaces// /${blocks2}${reset}nl}"
|
||||||
|
|
||||||
# Add newlines to the string.
|
# Add newlines to the string.
|
||||||
cols="${cols%%'nl'}"
|
cols="${cols%%'nl'}"
|
||||||
cols="${cols//nl/\\n\\033[${text_padding}C${zws}}"
|
cols="${cols//nl/\\n\\033[${text_padding}C${zws}}"
|
||||||
|
|
||||||
|
# Add block height to info height.
|
||||||
|
info_height="$((info_height+=block_height+2))"
|
||||||
|
|
||||||
printf "%b\n" "\033[${text_padding}C${zws}${cols}"
|
printf "%b\n" "\033[${text_padding}C${zws}${cols}"
|
||||||
else
|
|
||||||
printf "\n"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info_height="$((info_height+=block_height+2))"
|
|
||||||
unset -v blocks blocks2 cols
|
unset -v blocks blocks2 cols
|
||||||
|
|
||||||
# Tell info() that we printed manually.
|
# Tell info() that we printed manually.
|
||||||
|
@ -3517,6 +3517,9 @@ dynamic_prompt() {
|
||||||
lines="$((lines - info_height))"
|
lines="$((lines - info_height))"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Print a newline if color blocks are disabled.
|
||||||
|
[[ -z "$block_spaces" ]] && printf "\n"
|
||||||
|
|
||||||
# Set the prompt location.
|
# Set the prompt location.
|
||||||
((lines > 0)) && printf "%b" "\033[${lines}B"
|
((lines > 0)) && printf "%b" "\033[${lines}B"
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue