c5798b5b8c
Softwrap implementation enhanced to fix various issues with scrolling, centering, relocating etc. The main idea is simple: work not with simple line numbers but with (Line, Row) pairs, where Line is a line number in the buffer and Row is a visual line (a row) number within this line. The logic remains mostly the same, but simple arithmetic operations on line numbers are replaced with corresponding operations on (Line, Row) pairs. Fixes #632, #1657
34 lines
808 B
Go
34 lines
808 B
Go
package action
|
|
|
|
import "github.com/zyedidia/micro/v2/internal/buffer"
|
|
|
|
var InfoBar *InfoPane
|
|
var LogBufPane *BufPane
|
|
|
|
// InitGlobals initializes the log buffer and the info bar
|
|
func InitGlobals() {
|
|
InfoBar = NewInfoBar()
|
|
buffer.LogBuf = buffer.NewBufferFromString("", "Log", buffer.BTLog)
|
|
}
|
|
|
|
// 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()
|
|
}
|