mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-10 04:54:03 -08:00
parent
08b631a994
commit
96868bfd4f
|
@ -309,6 +309,14 @@ func (pt *Path) getUniqueLettersPath(maxWidth int) string {
|
|||
if pt.root != pt.env.PathSeparator() {
|
||||
elements = append([]string{pt.root}, elements...)
|
||||
}
|
||||
|
||||
if maxWidth > 0 {
|
||||
path := strings.Join(elements, separator)
|
||||
if len(path) <= maxWidth {
|
||||
return path
|
||||
}
|
||||
}
|
||||
|
||||
n := len(elements)
|
||||
letters := make(map[string]bool)
|
||||
for i := 0; i < n-1; i++ {
|
||||
|
|
|
@ -203,7 +203,7 @@ func TestAgnosterPathStyles(t *testing.T) {
|
|||
Style: Powerlevel,
|
||||
Expected: "t > w > o > a > v > l > p > wh > we > i > wa > th > the > d > f > u > it > c > to > a > co > stream",
|
||||
HomePath: homeDir,
|
||||
Pwd: "there/was/once/a/very/long/path/which/wended/its/way/through/the/dark/forest/until/it/came/to/a/cold/stream",
|
||||
Pwd: "/there/was/once/a/very/long/path/which/wended/its/way/through/the/dark/forest/until/it/came/to/a/cold/stream",
|
||||
PathSeparator: "/",
|
||||
FolderSeparatorIcon: " > ",
|
||||
MaxWidth: 20,
|
||||
|
@ -212,11 +212,20 @@ func TestAgnosterPathStyles(t *testing.T) {
|
|||
Style: Powerlevel,
|
||||
Expected: "t > w > o > a > v > l > p > which > wended > its > way > through > the",
|
||||
HomePath: homeDir,
|
||||
Pwd: "there/was/once/a/very/long/path/which/wended/its/way/through/the",
|
||||
Pwd: "/there/was/once/a/very/long/path/which/wended/its/way/through/the",
|
||||
PathSeparator: "/",
|
||||
FolderSeparatorIcon: " > ",
|
||||
MaxWidth: 70,
|
||||
},
|
||||
{
|
||||
Style: Powerlevel,
|
||||
Expected: "var/cache/pacman",
|
||||
HomePath: homeDir,
|
||||
Pwd: "/var/cache/pacman",
|
||||
PathSeparator: "/",
|
||||
FolderSeparatorIcon: "/",
|
||||
MaxWidth: 50,
|
||||
},
|
||||
|
||||
{
|
||||
Style: Letter,
|
||||
|
|
Loading…
Reference in a new issue