mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-23 23:51:58 +00:00
when replacing parts of cwd with "...", make sure there is more than 1 char to be replaced
This commit is contained in:
parent
7cfe479c87
commit
b910da06a0
1 changed files with 2 additions and 2 deletions
|
@ -832,7 +832,7 @@ prompt_dir() {
|
||||||
|
|
||||||
case $POWERLEVEL9K_SHORTEN_STRATEGY in
|
case $POWERLEVEL9K_SHORTEN_STRATEGY in
|
||||||
truncate_absolute|truncate_absolute_chars)
|
truncate_absolute|truncate_absolute_chars)
|
||||||
if (( POWERLEVEL9K_SHORTEN_DIR_LENGTH > 0 && $#p > POWERLEVEL9K_SHORTEN_DIR_LENGTH )); then
|
if (( POWERLEVEL9K_SHORTEN_DIR_LENGTH > 0 && $#p > POWERLEVEL9K_SHORTEN_DIR_LENGTH + 1 )); then
|
||||||
local -i n=POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
local -i n=POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
||||||
local -i i=$#parts
|
local -i i=$#parts
|
||||||
while true; do
|
while true; do
|
||||||
|
@ -873,7 +873,7 @@ prompt_dir() {
|
||||||
[[ $POWERLEVEL9K_SHORTEN_STRATEGY == truncate_middle ]] && suf=pref
|
[[ $POWERLEVEL9K_SHORTEN_STRATEGY == truncate_middle ]] && suf=pref
|
||||||
for (( ; i < $#parts; ++i )); do
|
for (( ; i < $#parts; ++i )); do
|
||||||
local dir=$parts[i]
|
local dir=$parts[i]
|
||||||
if (( $#dir > pref + suf )); then
|
if (( $#dir > pref + suf + 1 )); then
|
||||||
dir[pref+1,-suf-1]=$'\0'
|
dir[pref+1,-suf-1]=$'\0'
|
||||||
parts[i]=$dir
|
parts[i]=$dir
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue