mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-25 18:07:07 +09:00
Fixing missing case for handling root node for splitting, fixes #3980
This commit is contained in:
@@ -413,7 +413,7 @@ func (n *Node) HSplit(bottom bool) uint64 {
|
|||||||
if !n.IsLeaf() {
|
if !n.IsLeaf() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
if n.Kind == STUndef {
|
if n.parent == nil {
|
||||||
n.Kind = STVert
|
n.Kind = STVert
|
||||||
}
|
}
|
||||||
if n.Kind == STVert {
|
if n.Kind == STVert {
|
||||||
@@ -429,13 +429,13 @@ func (n *Node) VSplit(right bool) uint64 {
|
|||||||
if !n.IsLeaf() {
|
if !n.IsLeaf() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
if n.Kind == STUndef {
|
if n.parent == nil {
|
||||||
n.Kind = STHoriz
|
n.Kind = STHoriz
|
||||||
}
|
}
|
||||||
if n.Kind == STVert {
|
if n.Kind == STHoriz {
|
||||||
return n.vVSplit(right)
|
return n.hVSplit(0, right)
|
||||||
}
|
}
|
||||||
return n.hVSplit(0, right)
|
return n.vVSplit(right)
|
||||||
}
|
}
|
||||||
|
|
||||||
// unsplits the child of a split
|
// unsplits the child of a split
|
||||||
@@ -531,11 +531,19 @@ func (n *Node) flatten() {
|
|||||||
func (n *Node) String() string {
|
func (n *Node) String() string {
|
||||||
var strf func(n *Node, ident int) string
|
var strf func(n *Node, ident int) string
|
||||||
strf = func(n *Node, ident int) string {
|
strf = func(n *Node, ident int) string {
|
||||||
marker := "|"
|
marker := ""
|
||||||
if n.Kind == STHoriz {
|
if n.Kind == STHoriz {
|
||||||
marker = "-"
|
marker = "-"
|
||||||
|
} else if n.Kind == STVert {
|
||||||
|
marker = "|"
|
||||||
}
|
}
|
||||||
str := fmt.Sprint(strings.Repeat("\t", ident), marker, n.View, n.id)
|
|
||||||
|
var parentId uint64 = 0
|
||||||
|
if n.parent != nil {
|
||||||
|
parentId = n.parent.id
|
||||||
|
}
|
||||||
|
|
||||||
|
str := fmt.Sprint(strings.Repeat("\t", ident), marker, n.View, n.id, parentId)
|
||||||
if n.IsLeaf() {
|
if n.IsLeaf() {
|
||||||
str += "🍁"
|
str += "🍁"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user