]> git.lizzy.rs Git - micro.git/blob - cmd/micro/action/editpane.go
Merge cursors after any event
[micro.git] / cmd / micro / action / editpane.go
1 package action
2
3 import (
4         "github.com/zyedidia/micro/cmd/micro/buffer"
5         "github.com/zyedidia/micro/cmd/micro/display"
6         "github.com/zyedidia/micro/cmd/micro/info"
7         "github.com/zyedidia/micro/cmd/micro/views"
8 )
9
10 type EditPane struct {
11         display.Window
12         *BufHandler
13 }
14
15 type InfoPane struct {
16         display.Window
17         *InfoHandler
18         *info.InfoBuf
19 }
20
21 func NewBufEditPane(x, y, width, height int, b *buffer.Buffer) *EditPane {
22         e := new(EditPane)
23         // TODO: can probably replace editpane with bufhandler entirely
24         w := display.NewBufWindow(x, y, width, height, b)
25         e.Window = w
26         e.BufHandler = NewBufHandler(b, w)
27
28         return e
29 }
30
31 func NewTabPane(width, height int, b *buffer.Buffer) *TabPane {
32         t := new(TabPane)
33         t.Node = views.NewRoot(0, 0, width, height)
34
35         e := NewBufEditPane(0, 0, width, height, b)
36         e.splitID = t.ID()
37
38         t.Panes = append(t.Panes, e)
39         return t
40 }
41
42 func NewInfoBar() *InfoPane {
43         e := new(InfoPane)
44         ib := info.NewBuffer()
45         w := display.NewInfoWindow(ib)
46         e.Window = w
47         e.InfoHandler = NewInfoHandler(ib, w)
48         e.InfoBuf = ib
49
50         return e
51 }