1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-14 00:50:08 +00:00

Merge pull request #1036 from dritter/fix_truncate_package_name

Make truncate with package name work without setting shorten length
This commit is contained in:
Dominik Ritter 2018-11-16 21:01:59 +01:00 committed by GitHub
commit e47b0daaf7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -803,7 +803,7 @@ prompt_dir() {
# if we are not in "~" or "/", split the paths into an array and exclude "~"
(( ${#current_path} > 1 )) && paths=(${(s:/:)${current_path//"~\/"/}}) || paths=()
# only run the code if SHORTEN_DIR_LENGTH is set, or we are using the two strategies that don't rely on it.
if [[ -n "$POWERLEVEL9K_SHORTEN_DIR_LENGTH" || "$POWERLEVEL9K_SHORTEN_STRATEGY" == "truncate_with_folder_marker" || "$POWERLEVEL9K_SHORTEN_STRATEGY" == "truncate_to_last" ]]; then
if [[ -n "$POWERLEVEL9K_SHORTEN_DIR_LENGTH" || "$POWERLEVEL9K_SHORTEN_STRATEGY" == "truncate_with_folder_marker" || "$POWERLEVEL9K_SHORTEN_STRATEGY" == "truncate_to_last" || "$POWERLEVEL9K_SHORTEN_STRATEGY" == "truncate_with_package_name" ]]; then
set_default POWERLEVEL9K_SHORTEN_DELIMITER "\u2026"
# convert delimiter from unicode to literal character, so that we can get the correct length later
local delim=$(echo -n $POWERLEVEL9K_SHORTEN_DELIMITER)