diff options
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | vis-lua.c | 7 |
2 files changed, 8 insertions, 0 deletions
@@ -619,6 +619,7 @@ At this time there exists no API stability guarantees. - `map(mode, key, function)` map a Lua function to `key` in `mode`, local to the given window - `style_define(id, style)` where `id` is a constant and `style` a string - `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 - `cursor` - `line` (1 based), `col` (1 based) - `to(line, col)` @@ -594,6 +594,13 @@ static int window_index(lua_State *L) { if (lua_isstring(L, 2)) { const char *key = lua_tostring(L, 2); + + if (strcmp(key, "viewport") == 0) { + Filerange r = win ? view_viewport_get(win->view) : text_range_empty(); + pushrange(L, &r); + return 1; + } + if (strcmp(key, "file") == 0) { obj_ref_new(L, win->file, "vis.file"); return 1; |
