mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2026-09-29 00:04:36 +00:00
Updated truncate_from_right test
This commit is contained in:
@@ -723,8 +723,7 @@ set_default POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD false
|
|||||||
# * $1 Alignment: string - left|right
|
# * $1 Alignment: string - left|right
|
||||||
# * $2 Index: integer
|
# * $2 Index: integer
|
||||||
prompt_dir() {
|
prompt_dir() {
|
||||||
local current_dir="$(echo $PWD)"
|
local current_dir="$(print -P '%~')"
|
||||||
current_dir=${current_dir//$HOME/"~"}
|
|
||||||
local paths
|
local paths
|
||||||
[[ current_dir != "/" ]] && paths=(${(s:/:)current_dir}) # only split if not root folder
|
[[ current_dir != "/" ]] && paths=(${(s:/:)current_dir}) # only split if not root folder
|
||||||
local cur_path cur_short_path directory dir_length cur_dir
|
local cur_path cur_short_path directory dir_length cur_dir
|
||||||
@@ -762,7 +761,7 @@ prompt_dir() {
|
|||||||
cur_dir=$directory
|
cur_dir=$directory
|
||||||
dir_length=${#cur_dir}
|
dir_length=${#cur_dir}
|
||||||
local threshhold=$(( $POWERLEVEL9K_SHORTEN_DIR_LENGTH + ${#delim} ))
|
local threshhold=$(( $POWERLEVEL9K_SHORTEN_DIR_LENGTH + ${#delim} ))
|
||||||
if (( $dir_length > $threshhold )) && [[ $cur_dir != $paths[${#paths}] ]]; then # only shorten if long enough and not last path
|
if (( ( $dir_length + 1) > $threshhold )) && [[ $cur_dir != $paths[${#paths}] ]]; then # only shorten if long enough and not last path
|
||||||
cur_dir=${cur_dir:0:$POWERLEVEL9K_SHORTEN_DIR_LENGTH}$delim
|
cur_dir=${cur_dir:0:$POWERLEVEL9K_SHORTEN_DIR_LENGTH}$delim
|
||||||
fi
|
fi
|
||||||
cur_short_path+="$cur_dir/"
|
cur_short_path+="$cur_dir/"
|
||||||
|
|||||||
Reference in New Issue
Block a user