Count line breaks when calculating cursor position

This commit is contained in:
Dylan Araps 2016-10-22 10:11:18 +11:00
parent 50f87a4233
commit ad2b18ef07

View file

@ -2722,6 +2722,9 @@ bold() {
getlinebreak() { getlinebreak() {
linebreak=" " linebreak=" "
# Calculate info height
info_height="$((info_height+=1))"
} }
# }}} # }}}
@ -2910,10 +2913,10 @@ dynamicprompt() {
# Calculate image height in terminal cells. # Calculate image height in terminal cells.
# The '+ 1' adds a gap between the prompt and the content. # The '+ 1' adds a gap between the prompt and the content.
if [ "$image" != "ascii" ]; then if [ "$image" != "ascii" ]; then
lines="$((${height:-1} / ${font_height:-1} + 2))" lines="$((${height:-1} / ${font_height:-1} + 3))"
cursor_yoffset="$((${yoffset:-1} / ${font_height:-1}))" cursor_yoffset="$((${yoffset:-1} / ${font_height:-1}))"
else else
cursor_yoffset="0 - 4" cursor_yoffset="0 - 2"
fi fi
# If the info is higher than the ascii/image place the prompt # If the info is higher than the ascii/image place the prompt