]> git.lizzy.rs Git - micro.git/blobdiff - cmd/micro/split_tree.go
Merge pull request #1200 from Calinou/add-systemd-timer-section
[micro.git] / cmd / micro / split_tree.go
index 37a1a17b4fcd4502b6af80fbc87136e3be956dea..e34c37f1335865b1d146557afd922c1a61da94b2 100644 (file)
@@ -1,6 +1,6 @@
 package main
 
-// SpltType specifies whether a split is horizontal or vertical
+// SplitType specifies whether a split is horizontal or vertical
 type SplitType bool
 
 const (
@@ -70,11 +70,11 @@ func (l *LeafNode) VSplit(buf *Buffer, splitIndex int) {
                copy(l.parent.children[splitIndex+1:], l.parent.children[splitIndex:])
                l.parent.children[splitIndex] = NewLeafNode(newView, l.parent)
 
-               tab.views = append(tab.views, nil)
-               copy(tab.views[splitIndex+1:], tab.views[splitIndex:])
-               tab.views[splitIndex] = newView
+               tab.Views = append(tab.Views, nil)
+               copy(tab.Views[splitIndex+1:], tab.Views[splitIndex:])
+               tab.Views[splitIndex] = newView
 
-               tab.curView = splitIndex
+               tab.CurView = splitIndex
        } else {
                if splitIndex > 1 {
                        splitIndex = 1
@@ -94,11 +94,11 @@ func (l *LeafNode) VSplit(buf *Buffer, splitIndex int) {
                l.parent.children[search(l.parent.children, l)] = s
                l.parent = s
 
-               tab.views = append(tab.views, nil)
-               copy(tab.views[splitIndex+1:], tab.views[splitIndex:])
-               tab.views[splitIndex] = newView
+               tab.Views = append(tab.Views, nil)
+               copy(tab.Views[splitIndex+1:], tab.Views[splitIndex:])
+               tab.Views[splitIndex] = newView
 
-               tab.curView = splitIndex
+               tab.CurView = splitIndex
        }
 
        tab.Resize()
@@ -123,11 +123,11 @@ func (l *LeafNode) HSplit(buf *Buffer, splitIndex int) {
                copy(l.parent.children[splitIndex+1:], l.parent.children[splitIndex:])
                l.parent.children[splitIndex] = NewLeafNode(newView, l.parent)
 
-               tab.views = append(tab.views, nil)
-               copy(tab.views[splitIndex+1:], tab.views[splitIndex:])
-               tab.views[splitIndex] = newView
+               tab.Views = append(tab.Views, nil)
+               copy(tab.Views[splitIndex+1:], tab.Views[splitIndex:])
+               tab.Views[splitIndex] = newView
 
-               tab.curView = splitIndex
+               tab.CurView = splitIndex
        } else {
                if splitIndex > 1 {
                        splitIndex = 1
@@ -139,7 +139,7 @@ func (l *LeafNode) HSplit(buf *Buffer, splitIndex int) {
                s.parent = l.parent
                newView := NewView(buf)
                newView.TabNum = l.parent.tabNum
-               newView.Num = len(tab.views)
+               newView.Num = len(tab.Views)
                if splitIndex == 1 {
                        s.children = []Node{l, NewLeafNode(newView, s)}
                } else {
@@ -148,11 +148,11 @@ func (l *LeafNode) HSplit(buf *Buffer, splitIndex int) {
                l.parent.children[search(l.parent.children, l)] = s
                l.parent = s
 
-               tab.views = append(tab.views, nil)
-               copy(tab.views[splitIndex+1:], tab.views[splitIndex:])
-               tab.views[splitIndex] = newView
+               tab.Views = append(tab.Views, nil)
+               copy(tab.Views[splitIndex+1:], tab.Views[splitIndex:])
+               tab.Views[splitIndex] = newView
 
-               tab.curView = splitIndex
+               tab.CurView = splitIndex
        }
 
        tab.Resize()
@@ -167,16 +167,16 @@ func (l *LeafNode) Delete() {
        l.parent.children = l.parent.children[:len(l.parent.children)-1]
 
        tab := tabs[l.parent.tabNum]
-       j := findView(tab.views, l.view)
-       copy(tab.views[j:], tab.views[j+1:])
-       tab.views[len(tab.views)-1] = nil // or the zero value of T
-       tab.views = tab.views[:len(tab.views)-1]
+       j := findView(tab.Views, l.view)
+       copy(tab.Views[j:], tab.Views[j+1:])
+       tab.Views[len(tab.Views)-1] = nil // or the zero value of T
+       tab.Views = tab.Views[:len(tab.Views)-1]
 
-       for i, v := range tab.views {
+       for i, v := range tab.Views {
                v.Num = i
        }
-       if tab.curView > 0 {
-               tab.curView--
+       if tab.CurView > 0 {
+               tab.CurView--
        }
 }
 
@@ -255,7 +255,6 @@ func (s *SplitTree) ResizeSplits() {
                        }
 
                        n.view.ToggleTabbar()
-                       n.view.matches = Match(n.view)
                } else if n, ok := node.(*SplitTree); ok {
                        if s.kind == VerticalSplit {
                                if !n.lockWidth {