mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-29 22:27:13 +09:00
Begin tab implementation
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user