diff options
author | Mamoru Komachi <usata@gentoo.org> | 2005-05-05 15:12:16 +0000 |
---|---|---|
committer | Mamoru Komachi <usata@gentoo.org> | 2005-05-05 15:12:16 +0000 |
commit | 7362b2a2a57f7cafebe4113cc78da1a496e82df7 (patch) | |
tree | 4cc3b362031007f27f2efbec57d8f5e262c7c3a6 /app-shells/zsh/files/prompt_gentoo_setup | |
parent | new upstream version (diff) | |
download | historical-7362b2a2a57f7cafebe4113cc78da1a496e82df7.tar.gz historical-7362b2a2a57f7cafebe4113cc78da1a496e82df7.tar.bz2 historical-7362b2a2a57f7cafebe4113cc78da1a496e82df7.zip |
Do not use precmd to setup gentoo prompt; bug #90907. Stable on x86.
Package-Manager: portage-2.0.51.19
Diffstat (limited to 'app-shells/zsh/files/prompt_gentoo_setup')
-rw-r--r-- | app-shells/zsh/files/prompt_gentoo_setup | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/app-shells/zsh/files/prompt_gentoo_setup b/app-shells/zsh/files/prompt_gentoo_setup index ea5d59b7576a..abc3ceb154c5 100644 --- a/app-shells/zsh/files/prompt_gentoo_setup +++ b/app-shells/zsh/files/prompt_gentoo_setup @@ -14,7 +14,7 @@ prompt_gentoo_setup () { prompt_gentoo_user=${2:-'green'} prompt_gentoo_root=${3:-'red'} - if [ `/usr/bin/whoami` = 'root' ] + if [ "$USER" = 'root' ] then base_prompt="%{$fg_bold[$prompt_gentoo_root]%}%m%{$reset_color%} " else @@ -22,14 +22,10 @@ prompt_gentoo_setup () { fi post_prompt="%{$reset_color%}" - base_prompt_no_color=$(echo "$base_prompt" | perl -pe "s/%{.*?%}//g") - post_prompt_no_color=$(echo "$post_prompt" | perl -pe "s/%{.*?%}//g") + local color="%{*}" + base_prompt_no_color="${(S)base_prompt//${~color}/}" + post_prompt_no_color="${(S)post_prompt//${~color}/}" - precmd () { prompt_gentoo_precmd } - preexec () { } -} - -prompt_gentoo_precmd () { setopt noxtrace localoptions local base_prompt_expanded_no_color base_prompt_etc local prompt_length space_left @@ -37,16 +33,13 @@ prompt_gentoo_precmd () { base_prompt_expanded_no_color=$(print -P "$base_prompt_no_color") base_prompt_etc=$(print -P "$base_prompt%(4~|...|)%3~") prompt_length=${#base_prompt_etc} -# if [[ $prompt_length -lt 40 ]]; then -# path_prompt="%{$fg_bold[$prompt_adam1_color2]%}%(4~|...|)%3~%{$fg_bold[white]%}" -# else -# space_left=$(( $COLUMNS - $#base_prompt_expanded_no_color - 2 )) -# path_prompt="%{$fg_bold[$prompt_adam1_color3]%}%${space_left}<...<%~$prompt_newline%{$fg_bold_white%}" -# fi path_prompt="%{$fg_bold[$prompt_gentoo_prompt]%}%1~" PS1="$base_prompt$path_prompt %# $post_prompt" PS2="$base_prompt$path_prompt %_> $post_prompt" PS3="$base_prompt$path_prompt ?# $post_prompt" + + precmd () { } + preexec () { } } prompt_gentoo_setup "$@" |