From cc907ed657f12b61a5d13982f514dd8ba995eb50 Mon Sep 17 00:00:00 2001 From: Dylan Date: Fri, 29 Jan 2016 11:35:04 +1100 Subject: [PATCH] Set cursor position dynamically based on height of ascii and text --- fetch | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fetch b/fetch index 24dfc773..2f44912b 100755 --- a/fetch +++ b/fetch @@ -1937,8 +1937,13 @@ printf "\033[0H" printinfo # 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" +fi # Enable line wrap again [ "$line_wrap" == "off" ] && printf "\033[?7h"