Skip to content

Commit

Permalink
fix(path): display root path icon when using agnoster
Browse files Browse the repository at this point in the history
  • Loading branch information
lnu authored and JanDeDobbeleer committed Sep 30, 2021
1 parent 44b970f commit f67ee8e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/segment_path.go
Expand Up @@ -169,7 +169,7 @@ func (pt *path) getLetterPath() string {

func (pt *path) getAgnosterFullPath() string {
pwd := pt.getPwd()
if string(pwd[0]) == pt.env.getPathSeperator() {
if len(pwd) > 1 && string(pwd[0]) == pt.env.getPathSeperator() {
pwd = pwd[1:]
}
return pt.replaceFolderSeparators(pwd)
Expand Down
2 changes: 1 addition & 1 deletion src/segment_path_test.go
Expand Up @@ -305,7 +305,7 @@ func TestAgnosterPathStyles(t *testing.T) {
{Style: AgnosterShort, Expected: "~ > .. > man", HomePath: "/usr/home", Pwd: "/usr/home/whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
{Style: AgnosterShort, Expected: "~ > projects", HomePath: "/usr/home", Pwd: "/usr/home/projects", PathSeperator: "/", FolderSeparatorIcon: " > "},
{Style: AgnosterShort, Expected: "C:", HomePath: homeBillWindows, Pwd: "C:", PathSeperator: "\\", FolderSeparatorIcon: " > "},
{Style: AgnosterShort, Expected: "", HomePath: homeBillWindows, Pwd: "/", PathSeperator: "/", FolderSeparatorIcon: " > "},
{Style: AgnosterShort, Expected: "/", HomePath: homeBillWindows, Pwd: "/", PathSeperator: "/", FolderSeparatorIcon: " > "},
{Style: AgnosterShort, Expected: "foo", HomePath: homeBillWindows, Pwd: "/foo", PathSeperator: "/", FolderSeparatorIcon: " > "},

{Style: AgnosterShort, Expected: "usr > .. > bar > man", HomePath: "/usr/home", Pwd: "/usr/foo/bar/man", PathSeperator: "/", FolderSeparatorIcon: " > ", MaxDepth: 2},
Expand Down

0 comments on commit f67ee8e

Please sign in to comment.