Add split_tree and ability to create splits

This commit is contained in:
Zachary Yedidia
2016-08-11 10:45:35 -04:00
parent 2cbd9428aa
commit cbbe312762
7 changed files with 202 additions and 51 deletions

View File

@@ -768,6 +768,8 @@ func (v *View) Quit() bool {
if v.CanClose("Quit anyway? (yes, no, save) ") {
v.CloseBuffer()
if len(tabs[curTab].views) > 1 {
screen.Fini()
os.Exit(0)
} else if len(tabs) > 1 {
if len(tabs[v.TabNum].views) == 1 {
tabs = tabs[:v.TabNum+copy(tabs[v.TabNum:], tabs[v.TabNum+1:])]
@@ -778,7 +780,7 @@ func (v *View) Quit() bool {
curTab--
}
if curTab == 0 {
CurView().Resize(screen.Size())
// CurView().Resize(screen.Size())
CurView().matches = Match(CurView())
}
}
@@ -796,13 +798,13 @@ func (v *View) AddTab() bool {
tab.SetNum(len(tabs))
tabs = append(tabs, tab)
curTab++
if len(tabs) == 2 {
for _, t := range tabs {
for _, v := range t.views {
v.Resize(screen.Size())
}
}
}
// if len(tabs) == 2 {
// for _, t := range tabs {
// for _, v := range t.views {
// v.Resize(screen.Size())
// }
// }
// }
return true
}