summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristo Kotze <onaforeignshore@hotmail.co.uk>2018-02-17 17:26:11 +0300
committerChristo Kotze <onaforeignshore@hotmail.co.uk>2018-02-17 17:26:11 +0300
commitad4b284e56244842c69e5e99aac4d5626c10a542 (patch)
treee67f8d2e2c424cba1b97777936b3712d279d5411
parent110f54f7e2d38c0f59ea25fcc947144e317382f1 (diff)
Fixed accidentally truncating current folder too
-rwxr-xr-xpowerlevel9k.zsh-theme6
1 files changed, 3 insertions, 3 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 2f63b486..4abee3b4 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -725,7 +725,7 @@ set_default POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD false
prompt_dir() {
local current_dir="$(print -P "%~")"
local paths
- [[ current_dir != "/" ]] && paths=(${(s:/:)current_dir}) || paths[0] = "/"
+ [[ current_dir != "/" ]] && paths=(${(s:/:)current_dir})
local cur_path cur_short_path directory dir_length cur_dir
if [[ -n "$POWERLEVEL9K_SHORTEN_DIR_LENGTH" || "$POWERLEVEL9K_SHORTEN_STRATEGY" == "truncate_with_folder_marker" ]]; then
@@ -741,7 +741,7 @@ prompt_dir() {
do
cur_dir=$directory
dir_length=${#cur_dir}
- if (( $dir_length > $max_length )); then
+ if (( $dir_length > $max_length )) && [[ $cur_dir != $paths[${#paths}] ]]; then
last_pos=$(( $dir_length - $POWERLEVEL9K_SHORTEN_DIR_LENGTH ))
cur_dir=${cur_dir:0:$POWERLEVEL9K_SHORTEN_DIR_LENGTH}$POWERLEVEL9K_SHORTEN_DELIMITER${cur_dir:$last_pos:$dir_length}
fi
@@ -758,7 +758,7 @@ prompt_dir() {
for directory in ${paths[@]}
do
cur_dir=$directory
- if (( ${#cur_dir} > $POWERLEVEL9K_SHORTEN_DIR_LENGTH )); then
+ if (( ${#cur_dir} > $POWERLEVEL9K_SHORTEN_DIR_LENGTH && [[ $cur_dir != $paths[${#paths}] ]]; then
cur_dir=${cur_dir:0:$POWERLEVEL9K_SHORTEN_DIR_LENGTH}$POWERLEVEL9K_SHORTEN_DELIMITER
fi
cur_short_path+="$cur_dir/"