package action import ( "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/display" "github.com/zyedidia/micro/v2/internal/screen" ) // InfoBar is the global info bar. var InfoBar *InfoPane // MenuBar is the global menu bar. var MenuBar *display.MenuWindow // LogBufPane is a global log buffer. var LogBufPane *BufPane // InitGlobals initializes the log buffer and the info bar func InitGlobals() { InfoBar = NewInfoBar() buffer.LogBuf = buffer.NewBufferFromString("", "Log", buffer.BTLog) // Initialize menu bar at the top w, _ := screen.Screen.Size() MenuBar = display.NewMenuWindow(0, 0, w, 1) } // GetInfoBar returns the infobar pane func GetInfoBar() *InfoPane { return InfoBar } // WriteLog writes a string to the log buffer func WriteLog(s string) { buffer.WriteLog(s) if LogBufPane != nil { LogBufPane.CursorEnd() } } // OpenLogBuf opens the log buffer from the current bufpane // If the current bufpane is a log buffer nothing happens, // otherwise the log buffer is opened in a horizontal split func (h *BufPane) OpenLogBuf() { LogBufPane = h.HSplitBuf(buffer.LogBuf) LogBufPane.CursorEnd() }