vis

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

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

commit 3054982180ecc0a44456068e9f7be2e1d4d83524
parent b645d5b11069d73c7ed280924d0d7a7d1e2ce49b
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sun, 19 Mar 2017 12:13:44 +0100

vis-lua: make vis.win return nil if no window exists yet

This is only the case during editor startup before the first window is created.

Diffstat:
Mvis-lua.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/vis-lua.c b/vis-lua.c @@ -1216,14 +1216,16 @@ static int pipe_func(lua_State *L) { * Whether a macro is being recorded. * @tfield bool recording */ -// TODO vis.ui static int vis_index(lua_State *L) { Vis *vis = obj_ref_check(L, 1, "vis"); if (lua_isstring(L, 2)) { const char *key = lua_tostring(L, 2); if (strcmp(key, "win") == 0) { - obj_ref_new(L, vis->win, VIS_LUA_TYPE_WINDOW); + if (vis->win) + obj_ref_new(L, vis->win, VIS_LUA_TYPE_WINDOW); + else + lua_pushnil(L); return 1; }