| 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("", "", buffer.BTLog) |
| 15 |
buffer.LogBuf.SetName("Log") |
| 16 |
} |
| 17 |
|
| 18 |
// GetInfoBar returns the infobar pane |
| 19 |
func GetInfoBar() *InfoPane { |
| 20 |
return InfoBar |
| 21 |
} |
| 22 |
|
| 23 |
// WriteLog writes a string to the log buffer |
| 24 |
func WriteLog(s string) { |
| 25 |
buffer.WriteLog(s) |
| 26 |
if LogBufPane != nil { |
| 27 |
LogBufPane.CursorEnd() |
| 28 |
} |
| 29 |
} |
| 30 |
|
| 31 |
// OpenLogBuf opens the log buffer from the current bufpane |
| 32 |
// If the current bufpane is a log buffer nothing happens, |
| 33 |
// otherwise the log buffer is opened in a horizontal split |
| 34 |
func (h *BufPane) OpenLogBuf() { |
| 35 |
LogBufPane = h.HSplitBuf(buffer.LogBuf) |
| 36 |
LogBufPane.CursorEnd() |
| 37 |
} |