0a99ca0df0f53e546c9c6ac5240e38f3a2dd2c3b

Author
Murilo Opsfelder Araujo <mopsfelder@gmail.com>
Committer
Murilo Opsfelder Araujo <mopsfelder@gmail.com>
Date

Message

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>.

Diff

 1diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh
 2index ed4d23713dca292151e0dfd8c0e228ad0e000038..86200ccf6389829afeab01ad95689f6419d792f0 100644
 3--- a/plugins/mercurial/mercurial.plugin.zsh
 4+++ b/plugins/mercurial/mercurial.plugin.zsh
 5@@ -35,7 +35,7 @@ function hg_prompt_info {
 6   if [ $(in_hg) ]; then
 7     _DISPLAY=$(hg_get_branch_name)
 8     echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_HG_PROMPT_PREFIX\
 9-$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"
10+$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"
11     unset _DISPLAY
12   fi
13 }