mirror of
https://github.com/zyedidia/micro.git
synced 2025-06-18 14:55:38 -04:00
Simplifying unsplit logic
This commit is contained in:
parent
080d216ffd
commit
8e7089993d
@ -439,11 +439,12 @@ func (n *Node) VSplit(right bool) uint64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// unsplits the child of a split
|
// unsplits the child of a split
|
||||||
func (n *Node) unsplit(i int, h bool) {
|
func (n *Node) unsplit(i int) {
|
||||||
copy(n.children[i:], n.children[i+1:])
|
copy(n.children[i:], n.children[i+1:])
|
||||||
n.children[len(n.children)-1] = nil
|
n.children[len(n.children)-1] = nil
|
||||||
n.children = n.children[:len(n.children)-1]
|
n.children = n.children[:len(n.children)-1]
|
||||||
|
|
||||||
|
h := n.Kind == STVert
|
||||||
nonrs, numr := n.getResizeInfo(h)
|
nonrs, numr := n.getResizeInfo(h)
|
||||||
if numr == 0 {
|
if numr == 0 {
|
||||||
// This means that this was the last child
|
// This means that this was the last child
|
||||||
@ -470,12 +471,7 @@ func (n *Node) Unsplit() bool {
|
|||||||
ind = i
|
ind = i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if n.parent.Kind == STVert {
|
n.parent.unsplit(ind)
|
||||||
n.parent.unsplit(ind, true)
|
|
||||||
} else {
|
|
||||||
n.parent.unsplit(ind, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
if n.parent.IsLeaf() {
|
if n.parent.IsLeaf() {
|
||||||
return n.parent.Unsplit()
|
return n.parent.Unsplit()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user