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