(fn string)
| 62 | } |
| 63 | |
| 64 | func SetStatusInfoFnLua(fn string) { |
| 65 | luaFn := strings.Split(fn, ".") |
| 66 | if len(luaFn) <= 1 { |
| 67 | return |
| 68 | } |
| 69 | plName, plFn := luaFn[0], luaFn[1] |
| 70 | pl := config.FindPlugin(plName) |
| 71 | if pl == nil { |
| 72 | return |
| 73 | } |
| 74 | statusInfo[fn] = func(b *buffer.Buffer) string { |
| 75 | if pl == nil || !pl.IsLoaded() { |
| 76 | return "" |
| 77 | } |
| 78 | val, err := pl.Call(plFn, luar.New(ulua.L, b)) |
| 79 | if err == nil { |
| 80 | if v, ok := val.(lua.LString); !ok { |
| 81 | screen.TermMessage(plFn, "should return a string") |
| 82 | return "" |
| 83 | } else { |
| 84 | return string(v) |
| 85 | } |
| 86 | } |
| 87 | return "" |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | // NewStatusLine returns a statusline bound to a window |
| 92 | func NewStatusLine(win *BufWindow) *StatusLine { |
nothing calls this directly
no test coverage detected