mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-23 01:07:16 +09:00
add comment and let multi values to the log to make it easy to log. (#788)
* add comment and let multi values to the log to make it easy to log. * added WorkingDirectory to lua bindings (returns the current directory)
This commit is contained in:
@@ -70,9 +70,11 @@ type Messenger struct {
|
||||
gutterMessage bool
|
||||
}
|
||||
|
||||
func (m *Messenger) AddLog(msg string) {
|
||||
// AddLog sends a message to the log view
|
||||
func (m *Messenger) AddLog(msg ...interface{}) {
|
||||
logMessage := fmt.Sprint(msg...)
|
||||
buffer := m.getBuffer()
|
||||
buffer.insert(buffer.End(), []byte(msg+"\n"))
|
||||
buffer.insert(buffer.End(), []byte(logMessage+"\n"))
|
||||
buffer.Cursor.Loc = buffer.End()
|
||||
buffer.Cursor.Relocate()
|
||||
}
|
||||
|
||||
@@ -363,6 +363,7 @@ func main() {
|
||||
L.SetGlobal("Loc", luar.New(L, func(x, y int) Loc {
|
||||
return Loc{x, y}
|
||||
}))
|
||||
L.SetGlobal("WorkingDirectory", luar.New(L, os.Getwd))
|
||||
L.SetGlobal("JoinPaths", luar.New(L, filepath.Join))
|
||||
L.SetGlobal("DirectoryName", luar.New(L, filepath.Dir))
|
||||
L.SetGlobal("configDir", luar.New(L, configDir))
|
||||
|
||||
Reference in New Issue
Block a user