diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-05-21 13:01:42 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-05-22 00:05:31 +0200 |
| commit | a3a72bf147c9abaa54969bcb0024a3b6592d1c0f (patch) | |
| tree | bbc412c382bc84b00ff7855201e8c6a6a567c60b | |
| parent | 33b17306fb887b175ce62ad30af93d4dd9fd0d7e (diff) | |
| download | vis-a3a72bf147c9abaa54969bcb0024a3b6592d1c0f.tar.gz vis-a3a72bf147c9abaa54969bcb0024a3b6592d1c0f.tar.xz | |
vis-lua: add window.{width, height} read only properties
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | vis-lua.c | 10 |
2 files changed, 11 insertions, 0 deletions
@@ -621,6 +621,7 @@ At this time there exists no API stability guarantees. - `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 + - `width` and `height`, readonly, query window dimension - `cursor` - `line` (1 based), `col` (1 based) - `to(line, col)` @@ -603,6 +603,16 @@ static int window_index(lua_State *L) { return 1; } + if (strcmp(key, "width") == 0) { + lua_pushunsigned(L, vis_window_width_get(win)); + return 1; + } + + if (strcmp(key, "height") == 0) { + lua_pushunsigned(L, vis_window_height_get(win)); + return 1; + } + if (strcmp(key, "file") == 0) { obj_ref_new(L, win->file, "vis.file"); return 1; |
