Remove cursor pos line

This commit is contained in:
Dylan Araps 2016-10-01 12:28:21 +10:00
parent 823cce5893
commit 402abf90a8

View file

@ -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"
}
# }}}