]> git.lizzy.rs Git - micro.git/blobdiff - internal/views/splits.go
better top
[micro.git] / internal / views / splits.go
index 55d9d751f975dba7711d0a221d77d6bd4855925a..1168ab5d6aa9149bf24e70c438353535e372da9b 100644 (file)
@@ -456,9 +456,9 @@ func (n *Node) unsplit(i int, h bool) {
 
 // Unsplit deletes this split and resizes everything
 // else accordingly
-func (n *Node) Unsplit() {
-       if !n.IsLeaf() {
-               return
+func (n *Node) Unsplit() bool {
+       if !n.IsLeaf() || n.parent == nil {
+               return false
        }
        ind := 0
        for i, c := range n.parent.children {
@@ -473,8 +473,9 @@ func (n *Node) Unsplit() {
        }
 
        if n.parent.IsLeaf() {
-               n.parent.Unsplit()
+               return n.parent.Unsplit()
        }
+       return true
 }
 
 // String returns the string form of the node and all children (used for debugging)