1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-07 22:02:56 +03:00

Add a root item ("/") if files at top level have changed

This commit is contained in:
Stefan Haller
2025-03-01 07:25:26 +01:00
parent 0b42cfb568
commit 26459523f5
61 changed files with 663 additions and 448 deletions

View File

@@ -91,11 +91,11 @@ func renderAux[T any](
arr := []string{}
if !isRoot {
isCollapsed := collapsedPaths.IsCollapsed(node.GetPath())
isCollapsed := collapsedPaths.IsCollapsed(node.GetInternalPath())
arr = append(arr, renderLine(node, treeDepth, visualDepth, isCollapsed))
}
if collapsedPaths.IsCollapsed(node.GetPath()) {
if collapsedPaths.IsCollapsed(node.GetInternalPath()) {
return arr
}
@@ -293,7 +293,13 @@ func getColorForChangeStatus(changeStatus string) style.TextStyle {
}
func fileNameAtDepth(node *filetree.Node[models.File], depth int) string {
splitName := split(node.GetPath())
splitName := split(node.GetInternalPath())
if depth == 0 && splitName[0] == "." {
if len(splitName) == 1 {
return "/"
}
depth = 1
}
name := join(splitName[depth:])
if node.File != nil && node.File.IsRename() {
@@ -314,7 +320,13 @@ func fileNameAtDepth(node *filetree.Node[models.File], depth int) string {
}
func commitFileNameAtDepth(node *filetree.Node[models.CommitFile], depth int) string {
splitName := split(node.GetPath())
splitName := split(node.GetInternalPath())
if depth == 0 && splitName[0] == "." {
if len(splitName) == 1 {
return "/"
}
depth = 1
}
name := join(splitName[depth:])
return name