From 24fde4f6a6c2964d878dbbe92ea2d04efd613d7c Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 13 Jun 2016 19:50:20 +1000 Subject: [PATCH] Fix prompt issues --- neofetch | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/neofetch b/neofetch index 946f9a95..1e76d3dc 100755 --- a/neofetch +++ b/neofetch @@ -3309,18 +3309,25 @@ fi # Print the info printinfo -if [ "$image" != "off" ]; then - # Get cursor position - info_height="$(stty -echo; IFS=';' read -rdR -t 1 -d c -p $'\033[6n\033[c' ROW COL; printf "%s" "${ROW#*[}"; stty echo)" +# Dynamic prompt location. +case "$image" in + "ascii") + # Get cursor position + info_height="$(stty -echo; IFS=';' read -rdR -t 1 -d c -p $'\033[6n\033[c' ROW COL; printf "%s" "${ROW#*[}"; stty echo)" + + # Set cursor position dynamically based on height of ascii/text. + [ "${lines:-0}" -lt "${info_height:-0}" ] && lines="$info_height" + ;; + + "off") ;; # Calculate image height in terminal cells. - lines="$((${width:-1} / ${font_width:-1} / 2 + 3))" + *) lines="$((${width:-1} / ${font_width:-1} / 2 + 3))" ;; - # Set cursor position dynamically based on height of ascii/text. - [ "${lines:-0}" -lt "${info_height:-0}" ] && lines="$info_height" +esac - printf "%b%s" "\033[${lines}H" -fi +# Set the prompt location +printf "%b%s" "\033[${lines}H" # Re-enable line wrap [ "$line_wrap" == "off" ] && printf "%b%s" "\033[?7h"