plugins: mercurial: Update the order prompt vars are displayed

If a user sets ZSH_THEME_HG_PROMPT_* as the following, he ends up with
%{$reset_color%} resetting the bold style of last character ")" because
_SUFFIX was expanded before calling hg_dirty():

    ZSH_THEME_HG_PROMPT_PREFIX="%{$fg_bold[blue]%}hg:(%{$fg[white]%}"
    ZSH_THEME_HG_PROMPT_SUFFIX="%{$reset_color%}"
    ZSH_THEME_HG_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
    ZSH_THEME_HG_PROMPT_CLEAN="%{$fg[blue]%})"

With this patch, the variable ZSH_THEME_HG_PROMPT_SUFFIX is lastly
displayed, following the same order as in git_prompt_info(),
i.e. <prefix><dirty><suffix>.
This commit is contained in:
Murilo Opsfelder Araujo 2015-02-20 15:17:00 -02:00
parent 77140a2ea7
commit 0a99ca0df0

View File

@ -35,7 +35,7 @@ function hg_prompt_info {
if [ $(in_hg) ]; then
_DISPLAY=$(hg_get_branch_name)
echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_HG_PROMPT_PREFIX\
$ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_HG_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(hg_dirty)$ZSH_PROMPT_BASE_COLOR"
$ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_PROMPT_BASE_COLOR$(hg_dirty)$ZSH_THEME_HG_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR"
unset _DISPLAY
fi
}