6 "github.com/zyedidia/tcell"
10 // This contains all the views in this tab
11 // There is generally only one view per tab, but you can have
12 // multiple views with splits
14 // This is the current view for this tab
16 // Generally this is the name of the current view's buffer
20 func NewTabFromView(v *View) *Tab {
22 t.views = append(t.views, v)
27 func (t *Tab) SetNum(num int) {
28 for _, v := range t.views {
33 // CurView returns the current view
34 func CurView() *View {
35 curTab := tabs[curTab]
36 return curTab.views[curTab.curView]
39 func TabbarString() (string, map[int]int) {
41 indicies := make(map[int]int)
42 for i, t := range tabs {
48 str += t.views[t.curView].Buf.Name
54 indicies[len(str)-1] = i + 1
60 func TabbarHandleMouseEvent(event tcell.Event) bool {
65 switch e := event.(type) {
66 case *tcell.EventMouse:
68 if button == tcell.Button1 {
73 str, indicies := TabbarString()
79 for k := range indicies {
80 keys = append(keys, k)
83 for _, k := range keys {
85 tabnum = indicies[k] - 1
102 str, _ := TabbarString()
104 tabBarStyle := defStyle.Reverse(true)
105 if style, ok := colorscheme["tabbar"]; ok {
109 // Maybe there is a unicode filename?
110 fileRunes := []rune(str)
111 w, _ := screen.Size()
112 for x := 0; x < w; x++ {
113 if x < len(fileRunes) {
114 screen.SetContent(x, 0, fileRunes[x], nil, tabBarStyle)
116 screen.SetContent(x, 0, ' ', nil, tabBarStyle)