aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-05-19 11:04:46 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-05-19 11:04:46 +0300
commite860296bf9e9a11c20293e548cf329b7a18d4266 (patch)
treee7eb2b2fde8ce290956166f9a07ca790f7721719
parent4d2dea05470b21a6264ca294095b0480e7d49a3b (diff)
fix bold<->nonbold transitions in dir
-rwxr-xr-xpowerlevel9k.zsh-theme38
1 files changed, 18 insertions, 20 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 2be4cfbd..6c852828 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -198,7 +198,7 @@ left_prompt_segment() {
_p9k_color $4 $1 FOREGROUND
local fg_color=$_P9K_RETVAL
_p9k_foreground $fg_color
- local fg=$_P9K_RETVAL
+ local fg=%b$_P9K_RETVAL
_p9k_get_icon LEFT_SUBSEGMENT_SEPARATOR
local subsep=$_P9K_RETVAL
@@ -232,16 +232,16 @@ left_prompt_segment() {
# fi
local t=$#_P9K_T
- _P9K_T+=$bg$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS$icon # 1
- _P9K_T+=$bg$icon # 2
+ _P9K_T+=$bg$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS$icon # 1
+ _P9K_T+=$bg$icon # 2
if [[ -z $fg_color ]]; then
_p9k_foreground $DEFAULT_COLOR
- _P9K_T+=$bg$_P9K_RETVAL$subsep$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS$icon # 3
+ _P9K_T+=$bg$_P9K_RETVAL$subsep$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS$icon # 3
else
- _P9K_T+=$bg$fg$subsep$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS$icon # 3
+ _P9K_T+=$bg$fg$subsep$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS$icon # 3
fi
_p9k_get_icon LEFT_SEGMENT_SEPARATOR
- _P9K_T+=$bg$_P9K_RETVAL$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS$icon # 4
+ _P9K_T+=$bg$_P9K_RETVAL$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS$icon # 4
local pre
pre+="\${_P9K_N::=}\${_P9K_F::=}"
@@ -249,7 +249,7 @@ left_prompt_segment() {
pre+="\${\${_P9K_N:=\${\${\$((_P9K_I>=$_P9K_LEFT_JOIN[$2])):#0}:+$((t+2))}}+}" # 2
pre+="\${\${_P9K_N:=\${\${\$((!\${#\${:-0\$_P9K_BG}:#0$bg_color})):#0}:+$((t+3))}}+}" # 3
pre+="\${\${_P9K_N:=\${\${_P9K_F::=%F{\$_P9K_BG\}}+$((t+4))}}+}" # 4
- pre+="\$_P9K_F\${_P9K_T[\$_P9K_N]}"
+ pre+="\${_P9K_F}%b\${_P9K_T[\$_P9K_N]}"
local post="\${_P9K_C}$space\${\${_P9K_I::=$2}+}\${\${_P9K_BG::=$bg_color}+}}"
@@ -284,7 +284,7 @@ right_prompt_segment() {
_p9k_color $4 $1 FOREGROUND
local fg_color=$_P9K_RETVAL
_p9k_foreground $fg_color
- local fg=$_P9K_RETVAL
+ local fg=%b$_P9K_RETVAL
_p9k_get_icon RIGHT_SUBSEGMENT_SEPARATOR
local subsep=$_P9K_RETVAL
@@ -324,7 +324,7 @@ right_prompt_segment() {
pre+="\${\${_P9K_N:=\${\${\$((_P9K_I>=$_P9K_RIGHT_JOIN[$2])):#0}:+$((t+2))}}+}" # 2
pre+="\${\${_P9K_N:=\${\${\$((!\${#\${:-0\$_P9K_BG}:#0$bg_color})):#0}:+$((t+3))}}+}" # 3
pre+="\${\${_P9K_N:=$((t+1))}+}" # 4 == 1
- pre+="\${_P9K_T[\$_P9K_N]}\${_P9K_C}$icon_fg"
+ pre+="%b\${_P9K_T[\$_P9K_N]}\${_P9K_C}$icon_fg"
_p9k_escape_rcurly $POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS
local post="$icon$_P9K_RETVAL\${\${_P9K_I::=$2}+}\${\${_P9K_BG::=$bg_color}+}}"
@@ -933,8 +933,6 @@ prompt_dir() {
;;
esac
- parts=("${(@)parts//\%/%%}")
-
local state='' icon=''
if [[ $POWERLEVEL9K_DIR_SHOW_WRITABLE == true && ! -w $PWD ]]; then
state=NOT_WRITABLE
@@ -950,23 +948,23 @@ prompt_dir() {
_p9k_color "$DEFAULT_COLOR" "$0_$state" FOREGROUND
_p9k_foreground $_P9K_RETVAL
- local clr=$_P9K_RETVAL'%b'
+ local fg=%b$_P9K_RETVAL
- [[ $fake_first == 0 && $parts[1] == '~' ]] && parts[1]=$POWERLEVEL9K_HOME_FOLDER_ABBREVIATION$clr
+ parts=("${(@)parts//\%/%%}")
+ [[ $fake_first == 0 && $parts[1] == '~' ]] && parts[1]=$POWERLEVEL9K_HOME_FOLDER_ABBREVIATION$fg
[[ $POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER == true && $#parts > 1 && -n $parts[2] ]] && parts[1]=()
- parts=("${(@)parts//$'\0'/$POWERLEVEL9K_SHORTEN_DELIMITER$clr}")
+ local last_fg=
+ [[ $POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD == true ]] && last_fg+=%B
if [[ -n $POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND ]]; then
_p9k_translate_color $POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND
_p9k_foreground $_P9K_RETVAL
- parts[-1]=$_P9K_RETVAL$parts[-1]
- fi
-
- if [[ $POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD == true ]]; then
- parts[-1]='%B'$parts[-1]'%b'
+ last_fg+=$_P9K_RETVAL
fi
+ parts[-1]=$last_fg${parts[-1]//$'\0'/$'\0'$last_fg}
+ parts=("${(@)parts//$'\0'/$POWERLEVEL9K_SHORTEN_DELIMITER$fg}")
- local sep=$POWERLEVEL9K_DIR_PATH_SEPARATOR$clr
+ local sep=$POWERLEVEL9K_DIR_PATH_SEPARATOR$fg
if [[ -n $POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND ]]; then
_p9k_translate_color $POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND
_p9k_foreground $_P9K_RETVAL