Skip to content

Commit 8e70899

Browse files
Simplifying unsplit logic
1 parent 080d216 commit 8e70899

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

internal/views/splits.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,12 @@ func (n *Node) VSplit(right bool) uint64 {
439439
}
440440

441441
// unsplits the child of a split
442-
func (n *Node) unsplit(i int, h bool) {
442+
func (n *Node) unsplit(i int) {
443443
copy(n.children[i:], n.children[i+1:])
444444
n.children[len(n.children)-1] = nil
445445
n.children = n.children[:len(n.children)-1]
446446

447+
h := n.Kind == STVert
447448
nonrs, numr := n.getResizeInfo(h)
448449
if numr == 0 {
449450
// This means that this was the last child
@@ -470,12 +471,7 @@ func (n *Node) Unsplit() bool {
470471
ind = i
471472
}
472473
}
473-
if n.parent.Kind == STVert {
474-
n.parent.unsplit(ind, true)
475-
} else {
476-
n.parent.unsplit(ind, false)
477-
}
478-
474+
n.parent.unsplit(ind)
479475
if n.parent.IsLeaf() {
480476
return n.parent.Unsplit()
481477
}

0 commit comments

Comments
 (0)