Simplify cursor positioning

This commit is contained in:
Dylan Araps 2016-10-23 14:08:45 +11:00
parent d09cf58790
commit 09a4ac132e

View file

@ -2962,11 +2962,9 @@ dynamicprompt() {
# Calculate image height in terminal cells. # Calculate image height in terminal cells.
if [ "$image" != "ascii" ]; then if [ "$image" != "ascii" ]; then
gettermpadding gettermpadding
lines="$(((height + ${border:-0} + ${yoffset:-0}) / font_height))"
lines="$(((height + border) / font_height))"
cursor_yoffset="$((${yoffset:-1} / font_height))"
else else
cursor_yoffset="0 - 2" lines="$((lines-=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
@ -2974,7 +2972,7 @@ dynamicprompt() {
if [ "${lines:-0}" -lt "${info_height:-0}" ]; then if [ "${lines:-0}" -lt "${info_height:-0}" ]; then
lines="-2" lines="-2"
else else
lines="$((lines - info_height + cursor_yoffset))" lines="$((lines - info_height))"
fi fi
# Set the prompt location # Set the prompt location