diff --git a/functions/_tide_pwd.fish b/functions/_tide_pwd.fish index 3bd53b0..b2ea6ad 100644 --- a/functions/_tide_pwd.fish +++ b/functions/_tide_pwd.fish @@ -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.)\" \$dir_section && v=\$parent_dir/\$trunc*/ set -q v[2] + string match -qr \"(?\..|.)\" \$dir_section + while v=\$parent_dir/\$trunc*/ set -q v[2] && string match -qr \"(?\$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 diff --git a/tests/_tide_item_pwd.test.fish b/tests/_tide_item_pwd.test.fish index 3eccda7..ab298c1 100644 --- a/tests/_tide_item_pwd.test.fish +++ b/tests/_tide_item_pwd.test.fish @@ -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