Avoid duplication at the tip of the tree.

This commit is contained in:
Blallo 2020-03-02 11:27:02 +01:00
parent 0bd99eaff7
commit 67e51c9f1b
No known key found for this signature in database
GPG key ID: 0CBE577C9B72DC3F

View file

@ -257,12 +257,14 @@ func (i *Intermediate) String() string {
childLines := strings.Split(lines[treeSize-1], "\n")
lenChildLines := len(childLines)
out += fmt.Sprintf("%s%s%s\n", NodePad, NodeL, childLines[0])
for a := 1; a < lenChildLines-2; a++ {
out += fmt.Sprintf("%s%s%s\n", NodePad, NodePad, childLines[a])
}
if lenChildLines > 0 {
if lenChildLines > 1 {
out += fmt.Sprintf("%s%s%s\n", NodePad, NodeL, childLines[0])
for a := 1; a < lenChildLines-2; a++ {
out += fmt.Sprintf("%s%s%s\n", NodePad, NodePad, childLines[a])
}
out += fmt.Sprintf("%s%s%s", NodePad, NodePad, childLines[lenChildLines-1])
} else {
out += fmt.Sprintf("%s%s%s", NodePad, NodeL, childLines[0])
}
return out
}