Set cursor position dynamically based on height of ascii and text

This commit is contained in:
Dylan 2016-01-29 11:35:04 +11:00
parent 2b640891eb
commit cc907ed657
1 changed files with 6 additions and 1 deletions

7
fetch
View File

@ -1937,8 +1937,13 @@ printf "\033[0H"
printinfo printinfo
# Move the cursor to the bottom and Show the cursor # Move the cursor to the bottom and Show the cursor
[ "$image" != "off" ] && \ if [ "$image" != "off" ]; then
# Set cursor position dynamically based on height of ascii/text.
info_height="$(IFS=';' read -sdR -p $'\E[6n' ROW COL;echo "${ROW#*[}")"
[ "$lines" -lt "$info_height" ] && lines="$info_height"
printf "%b%s" "\033[${lines}H\033[${prompt_height}A" printf "%b%s" "\033[${lines}H\033[${prompt_height}A"
fi
# Enable line wrap again # Enable line wrap again
[ "$line_wrap" == "off" ] && printf "\033[?7h" [ "$line_wrap" == "off" ] && printf "\033[?7h"