mirror of
https://github.com/IlanCosman/tide.git
synced 2024-12-23 03:52:12 +03:00
Never truncate to just a dot (fixes #399)
This commit is contained in:
parent
270b2696b4
commit
447945d2cf
@ -26,7 +26,8 @@ eval "function _tide_pwd
|
||||
set split_output[\$i] \"$color_anchors\$dir_section$reset_to_color_dirs\"
|
||||
else if test \$_tide_pwd_len -gt \$dist_btwn_sides
|
||||
set -l trunc
|
||||
while string match -qr \"(?<trunc>\$trunc.)\" \$dir_section && v=\$parent_dir/\$trunc*/ set -q v[2]
|
||||
string match -qr \"(?<trunc>\..|.)\" \$dir_section
|
||||
while v=\$parent_dir/\$trunc*/ set -q v[2] && string match -qr \"(?<trunc>\$trunc.)\" \$dir_section
|
||||
end
|
||||
test -n \"\$trunc\" && set split_output[\$i] \"$color_truncated\$trunc$reset_to_color_dirs\" &&
|
||||
string join / \$split_output | string length -V | read _tide_pwd_len
|
||||
|
@ -114,5 +114,13 @@ _pwd "$tmpdir/tmp/--has dashes/foo" # CHECK: ~/tmp/--has dashes/foo
|
||||
mkdir -p "$tmpdir/tmp/has'quotes''/foo"
|
||||
_pwd "$tmpdir/tmp/has'quotes''/foo" # CHECK: ~/tmp/has'quotes''/foo
|
||||
|
||||
# ---------- Truncation with a dot directory ----------
|
||||
set -l longDirWithDot .zulu/bravo/charlie/delta/echo/foxtrot/golf/hotel/india/juliett/kilo/lima/mike/november/oscar/papa
|
||||
_pwd $tmpdir/tmp/$longDirWithDot # CHECK: ~/t/.z/b/c/d/e/f/golf/hotel/india/juliett/kilo/lima/mike/november/oscar/papa
|
||||
|
||||
mkdir -p $tmpdir/tmp/.zumwalt
|
||||
_pwd $tmpdir/tmp/$longDirWithDot # CHECK: ~/t/.zul/b/c/d/e/f/golf/hotel/india/juliett/kilo/lima/mike/november/oscar/papa
|
||||
command rm -r $tmpdir/tmp/.zumwalt
|
||||
|
||||
# ------------------------------------Cleanup------------------------------------
|
||||
command rm -r $tmpdir
|
||||
|
Loading…
Reference in New Issue
Block a user