mirror of
https://github.com/IlanCosman/tide.git
synced 2024-12-23 12:03:48 +03:00
Fix spaces in pwd bug (fixes #74)
This commit is contained in:
parent
e0aca078fb
commit
306a918dd9
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user