Added option to set prompt height which will fix the title going off screen on multi line prompts

This commit is contained in:
dylan araps 2016-01-05 16:46:53 +11:00
parent 264de7564a
commit 736b06ea3c
2 changed files with 13 additions and 2 deletions

View File

@ -88,6 +88,8 @@ Text Formatting:
--underline_char char Character to use when underlineing title
--line_wrap on/off Enable/Disable line wrapping
--bold on/off Enable/Disable bold text
--prompt_height num Set this to your prompt height to fix
issues with the text going off screen at the top
Color Blocks:
--color_blocks on/off Enable/Disable the color blocks

View File

@ -134,6 +134,12 @@ underline="on"
# --underline_char char
underline_char="-"
# Prompt height
# You should only have to change this if your
# prompt is greater than 2 lines high.
# --prompt_height num
prompt_height=1
# }}}
@ -715,6 +721,8 @@ usage () {
printf "%s\n" " --underline_char char Character to use when underlineing title"
printf "%s\n" " --line_wrap on/off Enable/Disable line wrapping"
printf "%s\n" " --bold on/off Enable/Disable bold text"
printf "%s\n" " --prompt_height num Set this to your prompt height to fix"
printf "%s\n" " issues with the text going off screen at the top"
printf "%s\n"
printf "%s\n" " Color Blocks:"
printf "%s\n" " --color_blocks on/off Enable/Disable the color blocks"
@ -795,6 +803,7 @@ while [ ! -z "$1" ]; do
--underline_char) underline_char="$2" ;;
--line_wrap) line_wrap="$2" ;;
--bold) bold="$2" ;;
--prompt_height) prompt_height="$2" ;;
# Color Blocks
--color_blocks) color_blocks="$2" ;;
@ -929,7 +938,7 @@ printinfo
[ $line_wrap == "off" ] && printf '\e[?7h'
# Move cursor to bottom and redisplay it.
printf "\e[${lines}H\e[1A\e[?25h"
printf "\e[${lines}H\e[${prompt_height}A\e[?25h"
# }}}