summaryrefslogtreecommitdiff
path: root/12_Prompts.zsh
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2010-09-02 11:28:18 +0200
committerHugues Hiegel <hugues@hiegel.fr>2010-09-02 11:28:18 +0200
commit946f047ebb44c1308c81337292da2020eee42496 (patch)
treebb3f37ac0940d5f8ca6d3f205427b49b28c09e6a /12_Prompts.zsh
parent96d4ec53ff2faafa47da96b63c99841507dbd45e (diff)
[Prompts] error code managment correction
Diffstat (limited to '12_Prompts.zsh')
-rw-r--r--12_Prompts.zsh22
1 files changed, 3 insertions, 19 deletions
diff --git a/12_Prompts.zsh b/12_Prompts.zsh
index 0819595..b3e0806 100644
--- a/12_Prompts.zsh
+++ b/12_Prompts.zsh
@@ -61,24 +61,6 @@ preexec ()
print -Pn "$C_$prompt_colors[exec]$_C"
}
-new_precmd()
-{
- #
- # Arrays
- # [0] prompt-style string
- # [1] total size
- # [2] color
- # [3] pre-string
- # [4] post-string
- #
- typeset -A ERROR DATE MAILS LOGIN HOST CWD GITINFO SVNINFO PRECMD
- ERROR[color] = $prompt_colors[error]
- ERROR[string] = "%(?;;%?)"
- ERROR[pre] = "-"
- ERROR[post] =
- ERROR[size] = ${#$(print -Pn $ERROR[pre]$ERROR[string]$ERROR[post])}
-}
-
set_prompt_date()
{
# Date
@@ -92,7 +74,6 @@ set_prompt_date()
update_prompt_elements()
{
# Error
- error=$(print -Pn "%(?;;-%?)") ## MUST BE the first operation else we lose the error code...
[ "$DEBUG" = "yes" ] && echo -n " Error code..."
ERRORSIZE=${#error}
ERROR="%(?;;"$C_$prompt_colors[bar]$_C"-"$C_$prompt_colors[error]$_C"%?)"
@@ -333,6 +314,9 @@ fi
precmd()
{
+ # this MUST BE the real first operation else we lose the error code...
+ error=$(print -Pn "%(?;;-%?)")
+
NEW_STATUS=$(zsh_status)
if [ $NEW_STATUS != $ZSH_STATUS ]
then