parent
b77980082c
commit
6d99d34eb0
2 changed files with 21 additions and 16 deletions
|
@ -1373,38 +1373,42 @@ func (h *BufPane) HSplitAction() bool {
|
||||||
|
|
||||||
// Unsplit closes all splits in the current tab except the active one
|
// Unsplit closes all splits in the current tab except the active one
|
||||||
func (h *BufPane) Unsplit() bool {
|
func (h *BufPane) Unsplit() bool {
|
||||||
n := MainTab().GetNode(h.splitID)
|
tab := h.tab
|
||||||
n.Unsplit()
|
n := tab.GetNode(h.splitID)
|
||||||
|
ok := n.Unsplit()
|
||||||
|
if ok {
|
||||||
|
tab.RemovePane(tab.GetPane(h.splitID))
|
||||||
|
tab.Resize()
|
||||||
|
tab.SetActive(len(tab.Panes) - 1)
|
||||||
|
|
||||||
MainTab().RemovePane(MainTab().GetPane(h.splitID))
|
|
||||||
MainTab().Resize()
|
|
||||||
MainTab().SetActive(len(MainTab().Panes) - 1)
|
|
||||||
return true
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// NextSplit changes the view to the next split
|
// NextSplit changes the view to the next split
|
||||||
func (h *BufPane) NextSplit() bool {
|
func (h *BufPane) NextSplit() bool {
|
||||||
a := MainTab().active
|
a := h.tab.active
|
||||||
if a < len(MainTab().Panes)-1 {
|
if a < len(h.tab.Panes)-1 {
|
||||||
a++
|
a++
|
||||||
} else {
|
} else {
|
||||||
a = 0
|
a = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
MainTab().SetActive(a)
|
h.tab.SetActive(a)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// PreviousSplit changes the view to the previous split
|
// PreviousSplit changes the view to the previous split
|
||||||
func (h *BufPane) PreviousSplit() bool {
|
func (h *BufPane) PreviousSplit() bool {
|
||||||
a := MainTab().active
|
a := h.tab.active
|
||||||
if a > 0 {
|
if a > 0 {
|
||||||
a--
|
a--
|
||||||
} else {
|
} else {
|
||||||
a = len(MainTab().Panes) - 1
|
a = len(h.tab.Panes) - 1
|
||||||
}
|
}
|
||||||
MainTab().SetActive(a)
|
h.tab.SetActive(a)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -456,9 +456,9 @@ func (n *Node) unsplit(i int, h bool) {
|
||||||
|
|
||||||
// Unsplit deletes this split and resizes everything
|
// Unsplit deletes this split and resizes everything
|
||||||
// else accordingly
|
// else accordingly
|
||||||
func (n *Node) Unsplit() {
|
func (n *Node) Unsplit() bool {
|
||||||
if !n.IsLeaf() {
|
if !n.IsLeaf() || n.parent == nil {
|
||||||
return
|
return false
|
||||||
}
|
}
|
||||||
ind := 0
|
ind := 0
|
||||||
for i, c := range n.parent.children {
|
for i, c := range n.parent.children {
|
||||||
|
@ -473,8 +473,9 @@ func (n *Node) Unsplit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if n.parent.IsLeaf() {
|
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)
|
// String returns the string form of the node and all children (used for debugging)
|
||||||
|
|
Loading…
Reference in a new issue