vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 8e2607c6e477aea6bc553fe554cc2cd9642cd4b2
parent 1dafe4ac773e8cc376ba2f3fb71067fcf9cd6d81
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sat, 21 May 2016 13:01:42 +0200

vis-lua: add window.{width, height} read only properties

Diffstat:
MREADME.md | 1+
Mvis-lua.c | 10++++++++++
2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -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)` diff --git a/vis-lua.c b/vis-lua.c @@ -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;