]> git.lizzy.rs Git - micro.git/blob - internal/action/globals.go
e20f61edfcadfa48e4a449cb34da5f1108fc3f18
[micro.git] / internal / action / globals.go
1 package action
2
3 import "github.com/zyedidia/micro/v2/internal/buffer"
4
5 var InfoBar *InfoPane
6 var LogBufPane *BufPane
7
8 // InitGlobals initializes the log buffer and the info bar
9 func InitGlobals() {
10         InfoBar = NewInfoBar()
11         buffer.LogBuf = buffer.NewBufferFromString("", "Log", buffer.BTLog)
12 }
13
14 // GetInfoBar returns the infobar pane
15 func GetInfoBar() *InfoPane {
16         return InfoBar
17 }
18
19 // WriteLog writes a string to the log buffer
20 func WriteLog(s string) {
21         buffer.WriteLog(s)
22         if LogBufPane != nil {
23                 LogBufPane.CursorEnd()
24         }
25 }
26
27 // OpenLogBuf opens the log buffer from the current bufpane
28 // If the current bufpane is a log buffer nothing happens,
29 // otherwise the log buffer is opened in a horizontal split
30 func (h *BufPane) OpenLogBuf() {
31         LogBufPane = h.HSplitBuf(buffer.LogBuf)
32         LogBufPane.CursorEnd()
33 }