Fix LP_OLD_PROMPT_COMMAND to work with zsh

This commit is contained in:
Panayiotis Kkolos 2014-03-08 08:08:47 +02:00 committed by Olivier Mengué
parent b4939868ce
commit 81b080e2a6

View File

@ -1539,7 +1539,11 @@ _lp_set_prompt()
local IFS="$_LP_IFS"
# execute the old prompt
eval "$LP_OLD_PROMPT_COMMAND"
if $_LP_SHELL_bash; then
eval "$LP_OLD_PROMPT_COMMAND"
else # zsh
eval "${${LP_OLD_PROMPT_COMMAND#*$'\n'}%$'\n'*}"
fi
# left of main prompt: space at right
LP_JOBS="$(_lp_sr "$(_lp_jobcount_color)")"
@ -1708,7 +1712,7 @@ prompt_on()
if $_LP_SHELL_bash; then
LP_OLD_PROMPT_COMMAND="$PROMPT_COMMAND"
else # zsh
LP_OLD_PROMPT_COMMAND="$precmd"
LP_OLD_PROMPT_COMMAND="$(whence -f precmd)"
fi
fi
if $_LP_SHELL_bash; then
@ -1740,7 +1744,8 @@ prompt_off()
if $_LP_SHELL_bash; then
PROMPT_COMMAND="$LP_OLD_PROMPT_COMMAND"
else # zsh
precmd="$LP_OLD_PROMPT_COMMAND"
precmd() { : ; }
eval "$LP_OLD_PROMPT_COMMAND"
fi
}
@ -1751,7 +1756,8 @@ prompt_OFF()
if $_LP_SHELL_bash; then
PROMPT_COMMAND="$LP_OLD_PROMPT_COMMAND"
else # zsh
precmd="$LP_OLD_PROMPT_COMMAND"
precmd() { : ; }
eval "$LP_OLD_PROMPT_COMMAND"
fi
}