mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-20 18:48:09 -08:00
parent
08b631a994
commit
96868bfd4f
|
@ -309,6 +309,14 @@ func (pt *Path) getUniqueLettersPath(maxWidth int) string {
|
||||||
if pt.root != pt.env.PathSeparator() {
|
if pt.root != pt.env.PathSeparator() {
|
||||||
elements = append([]string{pt.root}, elements...)
|
elements = append([]string{pt.root}, elements...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if maxWidth > 0 {
|
||||||
|
path := strings.Join(elements, separator)
|
||||||
|
if len(path) <= maxWidth {
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
n := len(elements)
|
n := len(elements)
|
||||||
letters := make(map[string]bool)
|
letters := make(map[string]bool)
|
||||||
for i := 0; i < n-1; i++ {
|
for i := 0; i < n-1; i++ {
|
||||||
|
|
|
@ -203,7 +203,7 @@ func TestAgnosterPathStyles(t *testing.T) {
|
||||||
Style: Powerlevel,
|
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",
|
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,
|
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: "/",
|
PathSeparator: "/",
|
||||||
FolderSeparatorIcon: " > ",
|
FolderSeparatorIcon: " > ",
|
||||||
MaxWidth: 20,
|
MaxWidth: 20,
|
||||||
|
@ -212,11 +212,20 @@ func TestAgnosterPathStyles(t *testing.T) {
|
||||||
Style: Powerlevel,
|
Style: Powerlevel,
|
||||||
Expected: "t > w > o > a > v > l > p > which > wended > its > way > through > the",
|
Expected: "t > w > o > a > v > l > p > which > wended > its > way > through > the",
|
||||||
HomePath: homeDir,
|
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: "/",
|
PathSeparator: "/",
|
||||||
FolderSeparatorIcon: " > ",
|
FolderSeparatorIcon: " > ",
|
||||||
MaxWidth: 70,
|
MaxWidth: 70,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Style: Powerlevel,
|
||||||
|
Expected: "var/cache/pacman",
|
||||||
|
HomePath: homeDir,
|
||||||
|
Pwd: "/var/cache/pacman",
|
||||||
|
PathSeparator: "/",
|
||||||
|
FolderSeparatorIcon: "/",
|
||||||
|
MaxWidth: 50,
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
Style: Letter,
|
Style: Letter,
|
||||||
|
|
Loading…
Reference in a new issue