Begin tab implementation

This commit is contained in:
Zachary Yedidia
2019-01-09 20:07:18 -05:00
parent 853c143696
commit d54ccace1f
8 changed files with 175 additions and 47 deletions

View File

@@ -36,36 +36,32 @@ func (w *UIWindow) Display() {
w.drawNode(w.root)
}
func (w *UIWindow) Clear() {}
func (w *UIWindow) Relocate() bool { return false }
func (w *UIWindow) GetView() *View { return nil }
func (w *UIWindow) SetView(*View) {}
func (w *UIWindow) GetMouseLoc(vloc buffer.Loc) buffer.Loc {
var mouseLoc func(*views.Node) buffer.Loc
mouseLoc = func(n *views.Node) buffer.Loc {
func (w *UIWindow) GetMouseSplitID(vloc buffer.Loc) uint64 {
var mouseLoc func(*views.Node) uint64
mouseLoc = func(n *views.Node) uint64 {
cs := n.Children()
for i, c := range cs {
if c.Kind == views.STVert {
if i != len(cs)-1 {
if vloc.X == c.X+c.W && vloc.Y >= c.Y && vloc.Y < c.Y+c.H {
return buffer.Loc{int(c.ID()), 0}
return c.ID()
}
}
} else if c.Kind == views.STHoriz {
if i != len(cs)-1 {
if vloc.Y == c.Y+c.H-1 && vloc.X >= c.X && vloc.X < c.X+c.W {
return buffer.Loc{int(c.ID()), 0}
return c.ID()
}
}
}
}
for _, c := range cs {
m := mouseLoc(c)
if m.X != -1 {
if m != 0 {
return m
}
}
return buffer.Loc{-1, 0}
return 0
}
return mouseLoc(w.root)
}