X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;ds=sidebyside;f=internal%2Fviews%2Fsplits.go;h=1168ab5d6aa9149bf24e70c438353535e372da9b;hb=90304fb472fab5a9809feb0d9b23b0930619cf0d;hp=55d9d751f975dba7711d0a221d77d6bd4855925a;hpb=f9ce549663cb271f3e0391cce4d680615a57ade6;p=micro.git diff --git a/internal/views/splits.go b/internal/views/splits.go index 55d9d751..1168ab5d 100644 --- a/internal/views/splits.go +++ b/internal/views/splits.go @@ -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)