From f37ffdd2b0ec9b8882e22f3e4b84b1dceb17112b Mon Sep 17 00:00:00 2001 From: Steven Xu Date: Fri, 24 Sep 2021 01:12:23 +1000 Subject: [PATCH] feat: only highlight the last directory in bold, if it's not an anchor --- internal/p10k.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 6928b8fc..4aedb346 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -2038,7 +2038,7 @@ prompt_dir() { _p9k_foreground $_p9k__ret last_style+=$_p9k__ret fi - if [[ -n $last_style ]]; then + if [[ -n $last_style && ! $parts[-1] =~ $'\2'$ ]]; then (( expand )) && _p9k_escape_style $last_style || _p9k__ret=$last_style parts[-1]=$_p9k__ret${parts[-1]//$'\1'/$'\1'$_p9k__ret}$style fi @@ -2054,7 +2054,7 @@ prompt_dir() { fi if [[ -n $anchor_style ]]; then (( expand )) && _p9k_escape_style $anchor_style || _p9k__ret=$anchor_style - if [[ -z $last_style ]]; then + if [[ -z $last_style || $parts[-1] =~ $'\2'$ ]]; then parts=("${(@)parts/%(#b)(*)$'\2'/$_p9k__ret$match[1]$style}") else (( $#parts > 1 )) && parts[1,-2]=("${(@)parts[1,-2]/%(#b)(*)$'\2'/$_p9k__ret$match[1]$style}")