From 0205c01ba952b9dee87b4f7b734e61c47607b7a4 Mon Sep 17 00:00:00 2001
From: romkatv <roman.perepelitsa@gmail.com>
Date: Thu, 5 Mar 2020 16:24:41 +0100
Subject: change the semantics of POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER to
 something useful

If POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER is set to true, it'll remove the leading
slash from the current directory if it's absolute. It will no longer do anything
if the directory is not absolute or if the leading character has been removed
or changed by the shortener.
---
 internal/p10k.zsh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index f79861a4..c8c80295 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -1915,8 +1915,9 @@ prompt_dir() {
       (( expand )) && _p9k_escape $_POWERLEVEL9K_HOME_FOLDER_ABBREVIATION || _p9k__ret=$_POWERLEVEL9K_HOME_FOLDER_ABBREVIATION
       parts[1]=$_p9k__ret
       [[ $_p9k__ret == *%* ]] && parts[1]+=$style
+    elif [[ $_POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER == 1 && $fake_first == 0 && $#parts > 1 && -z $parts[1] && -n $parts[2] ]]; then
+      parts[1]=()
     fi
-    [[ $_POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER == 1 && $#parts > 1 && -n $parts[2] ]] && parts[1]=()
 
     local last_style=
     (( _POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD )) && last_style+=%B
@@ -7422,7 +7423,7 @@ _p9k_must_init() {
     [[ $sig == $_p9k__param_sig ]] && return 1
     _p9k_deinit
   fi
-  _p9k__param_pat=$'v66\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1'
+  _p9k__param_pat=$'v67\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1'
   _p9k__param_pat+=$'${#parameters[(I)POWERLEVEL9K_*]}\1${(%):-%n%#}\1$GITSTATUS_LOG_LEVEL\1'
   _p9k__param_pat+=$'$GITSTATUS_ENABLE_LOGGING\1$GITSTATUS_DAEMON\1$GITSTATUS_NUM_THREADS\1'
   _p9k__param_pat+=$'$DEFAULT_USER\1${ZLE_RPROMPT_INDENT:-1}\1$P9K_SSH\1$__p9k_ksh_arrays'
-- 
cgit v1.2.3