General: Simplified prompt calculation, un-hardcoded line breaks. Closes #652
This commit is contained in:
parent
8fb4aec1ed
commit
b4e5169aa9
22
neofetch
22
neofetch
|
@ -2625,6 +2625,7 @@ get_line_break() {
|
||||||
|
|
||||||
# Calculate info height.
|
# Calculate info height.
|
||||||
((++info_height))
|
((++info_height))
|
||||||
|
line_breaks+=$'\n'
|
||||||
|
|
||||||
# Tell info() that we printed manually.
|
# Tell info() that we printed manually.
|
||||||
prin=1
|
prin=1
|
||||||
|
@ -3497,34 +3498,27 @@ get_term_padding() {
|
||||||
|
|
||||||
dynamic_prompt() {
|
dynamic_prompt() {
|
||||||
case "$image_backend" in
|
case "$image_backend" in
|
||||||
"ascii") ;;
|
"ascii") printf "\n" ;;
|
||||||
"off") return ;;
|
"off") return ;;
|
||||||
*)
|
*)
|
||||||
get_term_padding 2>/dev/null
|
get_term_padding
|
||||||
|
lines="$(((border + height + yoffset) / font_height))"
|
||||||
# Calculate image height in terminal cells.
|
image_prompt="on"
|
||||||
lines="$(((border * 2 + height + yoffset) / font_height))"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# If the info is higher than the ascii/image place the prompt
|
# If the info is higher than the ascii/image place the prompt
|
||||||
# based on the info height instead of the ascii/image height.
|
# based on the info height instead of the ascii/image height.
|
||||||
if ((lines < info_height)); then
|
if ((lines < info_height)); then
|
||||||
printf "\n"
|
[[ "$image_prompt" ]] && printf "\n"
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
|
[[ "$image_prompt" ]] && printf "%b\n" "$line_breaks"
|
||||||
lines="$((lines - info_height))"
|
lines="$((lines - info_height))"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set the prompt location.
|
# Set the prompt location.
|
||||||
if ((lines < 0)); then
|
((lines > 0)) && printf "%b" "\033[${lines}B"
|
||||||
printf "%b" "\033[${lines/-}A"
|
|
||||||
else
|
|
||||||
printf "%b" "\033[${lines}B"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Add some padding.
|
|
||||||
printf "\n\n\n\n"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
old_functions() {
|
old_functions() {
|
||||||
|
|
Reference in New Issue