We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a87f3dd commit 49fd03cCopy full SHA for 49fd03c
internal/views/splits.go
@@ -483,7 +483,17 @@ func (n *Node) Unsplit() bool {
483
// flattens the tree by removing unnecessary intermediate parents that have only one child
484
// and handles the side effect of it
485
func (n *Node) flatten() {
486
- if n.parent == nil || len(n.children) != 1 {
+ if len(n.children) != 1 {
487
+ return
488
+ }
489
+
490
+ // Special case for root node
491
+ if n.parent == nil {
492
+ *n = *n.children[0]
493
+ n.parent = nil
494
+ for _, c := range n.children {
495
+ c.parent = n
496
497
return
498
}
499
0 commit comments