Fix spaces in pwd bug (fixes #74)

This commit is contained in:
Ilan Cosman 2021-01-15 17:33:49 -08:00
parent e0aca078fb
commit 306a918dd9

View File

@ -28,18 +28,18 @@ function _tide_item_pwd
set -l pwdMaxLength (math $COLUMNS -$tide_pwd_truncate_margin)
for i in (seq (count $splitPwd))
set -l parentDir (string join '/' $splitPwd[1..(math $i-1)])
set -l parentDir (string join '/' $splitPwd[1..(math $i-1)] | string replace '~' $HOME)
# Returns true if any markers exist in splitPwd[$i], or if anchorDirs contains i
if test -z thisIsFalse (string split -m 2 " " -- "-o -e "$parentDir/$tide_pwd_markers) ||
contains $i $anchorDirs
# This line returns true if any markers exist in splitPwd[$i], or if anchorDirs contains i
if eval test -z thisPartIsFalse "-o -e $parentDir"/$splitPwd[$i]/$tide_pwd_markers || contains $i $anchorDirs
set splitPwdForOutput[$i] $colorAnchors$splitPwd[$i]$keepBackgroundColor$colorDirs
else if test (string join '/' $splitPwdForLength | string length) -gt $pwdMaxLength
set -l truncationLength 1
while set -l truncated (string sub --length $truncationLength $splitPwd[$i])
test (string length $truncated) -lt (string length $splitPwdForLength[$i]) || break
eval set -l truncatedPath $parentDir/$truncated
test (count $truncatedPath*/) -gt 1 || break
test (count $parentDir/$truncated*/) -gt 1 || break
set truncationLength (math $truncationLength + 1)
end