mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-30 06:37:14 +09:00
Add split_tree and ability to create splits
This commit is contained in:
@@ -15,6 +15,8 @@ type Tab struct {
|
||||
curView int
|
||||
// Generally this is the name of the current view's buffer
|
||||
name string
|
||||
|
||||
tree *SplitTree
|
||||
}
|
||||
|
||||
// NewTabFromView creates a new tab and puts the given view in the tab
|
||||
@@ -22,6 +24,14 @@ func NewTabFromView(v *View) *Tab {
|
||||
t := new(Tab)
|
||||
t.views = append(t.views, v)
|
||||
t.views[0].Num = 0
|
||||
|
||||
t.tree = new(SplitTree)
|
||||
t.tree.kind = VerticalSplit
|
||||
t.tree.children = []Node{NewLeafNode(t.views[0], t.tree)}
|
||||
|
||||
w, h := screen.Size()
|
||||
t.tree.width = w
|
||||
t.tree.height = h
|
||||
return t
|
||||
}
|
||||
|
||||
@@ -32,6 +42,10 @@ func (t *Tab) SetNum(num int) {
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Tab) Resize() {
|
||||
t.tree.ResizeSplits()
|
||||
}
|
||||
|
||||
// CurView returns the current view
|
||||
func CurView() *View {
|
||||
curTab := tabs[curTab]
|
||||
|
||||
Reference in New Issue
Block a user