From 402abf90a83226caeedff1672c4e32315b3e9bff Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 1 Oct 2016 12:28:21 +1000 Subject: [PATCH] Remove cursor pos line --- neofetch | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/neofetch b/neofetch index d76267d0..200cdf08 100755 --- a/neofetch +++ b/neofetch @@ -2327,6 +2327,9 @@ info() { # Print the string printf "%b%s\n" "${padding}${string}${reset}" + + # Calculate info height + info_height="$((info_height + 1))" } # }}} @@ -2359,6 +2362,9 @@ prin() { # Print the info printf "%b%s\n" "${padding}${string}${reset}" + + # Calculate info height + info_height="$((info_height + 1))" } # }}} @@ -2769,20 +2775,21 @@ kdeconfigdir() { # Dynamic prompt location {{{ dynamicprompt() { - # Get cursor position - info_height="$(IFS=';' builtin read -srdR -t 1 -d c -p $'\033[6n\033[c' ROW COL; printf "%s" "${ROW#*[}")" - # Calculate image height in terminal cells. # The '+ 3' adds a gap between the prompt and the content. [ "$image" != "ascii" ] && [ "$image" != "off" ] && \ - lines="$((${height:-1} / ${font_height:-1} + 3))" + lines="$((${height:-1} / ${font_height:-1} + 4))" # If the info is higher than the ascii/image place the prompt # based on the info height instead of the ascii/image height. - [ "${lines:-0}" -lt "${info_height:-0}" ] && lines="$info_height" + if [ "${lines:-0}" -lt "${info_height:-0}" ]; then + lines="$((info_height - lines - 2))" + else + lines="$((lines - info_height - 2))" + fi # Set the prompt location - [ "$image" != "off" ] && printf "%b%s" "\033[${lines:-0}H" + [ "$image" != "off" ] && printf "%b%s" "\033[${lines:-0}B" } # }}}