fixed prompt length bug

This commit is contained in:
Martinez 2015-02-26 21:45:47 +01:00
parent 86f83ced55
commit e5d1094566

View file

@ -1,5 +1,7 @@
#! /bin/zsh
autoload -U colors && colors
OVER_PROMPT_CFG="/etc/over/prompt.cfg"
if [[ -a "$OVER_PROMPT_CFG" ]]; then
@ -17,6 +19,8 @@ function precmd {
local OVER_OPTS RAW_DATA LOGIN_PART STATS_PART DATA TOP_LEFT TOP_RIGHT PADDING PADDING_SIZE
set -A OVER_OPTS ${(s. .)OVER_PROMPT_OPTS}
PS1="$(print "%(?.%{\e[1;36m%}.%{\e[1;31m%}%?%{\e[0m%}:%{\e[1;31m%})%(\!.#.$)%{\e[0m%} ")"
RAW_DATA="$(/usr/share/over-prompt/data $OVER_OPTS[1] $OVER_OPTS[2] $OVER_OPTS[3])"
if [ -n "$RAW_DATA" ]; then
@ -30,11 +34,8 @@ function precmd {
PADDING=$(printf " "%.0s {1..$PADDING_SIZE})
print "$TOP_LEFT$PADDING$TOP_RIGHT"
PS1="$(print "%(?.\e[1;36m.\e[1;31m%?\e[0m:\e[1;31m)%(!.#.$)\e[0m ")"
else
print -P "\e[5;31m!!! unable to run /usr/share/over-prompt/data\e[0m"
PS1="$(print "%(?.\e[1;36m.\e[1;31m%?\e[0m:\e[1;31m)%(!.#.$)\e[0m ")"
fi
}