Remove cursor pos line

This commit is contained in:
Dylan Araps 2016-10-01 12:28:21 +10:00
parent 823cce5893
commit 402abf90a8
1 changed files with 13 additions and 6 deletions

View File

@ -2327,6 +2327,9 @@ info() {
# Print the string # Print the string
printf "%b%s\n" "${padding}${string}${reset}" printf "%b%s\n" "${padding}${string}${reset}"
# Calculate info height
info_height="$((info_height + 1))"
} }
# }}} # }}}
@ -2359,6 +2362,9 @@ prin() {
# Print the info # Print the info
printf "%b%s\n" "${padding}${string}${reset}" printf "%b%s\n" "${padding}${string}${reset}"
# Calculate info height
info_height="$((info_height + 1))"
} }
# }}} # }}}
@ -2769,20 +2775,21 @@ kdeconfigdir() {
# Dynamic prompt location {{{ # Dynamic prompt location {{{
dynamicprompt() { 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. # Calculate image height in terminal cells.
# The '+ 3' adds a gap between the prompt and the content. # The '+ 3' adds a gap between the prompt and the content.
[ "$image" != "ascii" ] && [ "$image" != "off" ] && \ [ "$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 # If the info is higher than the ascii/image place the prompt
# based on the info height instead of the ascii/image height. # 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 # Set the prompt location
[ "$image" != "off" ] && printf "%b%s" "\033[${lines:-0}H" [ "$image" != "off" ] && printf "%b%s" "\033[${lines:-0}B"
} }
# }}} # }}}