vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit e8fdbd7b750d1212ae713c7ccc409dfa9db0b200 parent 8377f29e61519f664a82124aa4a41fad262bae02 Author: Marc André Tanner <mat@brain-dump.org> Date: Sat, 21 May 2016 22:30:40 +0200 vis-lua: add win:status function Diffstat:
| M | README.md | | | 1 | + |
| M | vis-lua.c | | | 10 | ++++++++++ |
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/README.md b/README.md @@ -623,6 +623,7 @@ At this time there exists no API stability guarantees. - `style(id, start, end)` apply style to file range, will be cleared after every redraw - `viewport` a range denoting the currently visible area of the window - `width` and `height`, readonly, query window dimension + - `status(text)` set the content of the window status bar - `cursor` - `line` (1 based), `col` (1 based) - `to(line, col)` diff --git a/vis-lua.c b/vis-lua.c @@ -718,6 +718,15 @@ static int window_style(lua_State *L) { return 0; } +static int window_status(lua_State *L) { + Win *win = obj_ref_check(L, 1, "vis.window"); + if (win) { + const char *status = luaL_checkstring(L, 2); + vis_window_status(win, status); + } + return 0; +} + static const struct luaL_Reg window_funcs[] = { { "__index", window_index }, { "__newindex", window_newindex }, @@ -725,6 +734,7 @@ static const struct luaL_Reg window_funcs[] = { { "map", window_map }, { "style_define", window_style_define }, { "style", window_style }, + { "status", window_status }, { NULL, NULL }, };