Skip to content

Commit

Permalink
vis-lua: do not enumerate internal windows
Browse files Browse the repository at this point in the history
This for example skips the command prompt window.
  • Loading branch information
martanne committed Nov 21, 2017
1 parent cb41e7e commit 2d4aebd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions vis-lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,9 @@ static const char *keymapping(Vis *vis, const char *keys, const Arg *arg) {
static int windows_iter(lua_State *L);
static int windows(lua_State *L) {
Vis *vis = obj_ref_check(L, 1, "vis");
Win **handle = lua_newuserdata(L, sizeof *handle);
*handle = vis->windows;
Win **handle = lua_newuserdata(L, sizeof *handle), *next;
for (next = vis->windows; next && next->file->internal; next = next->next);
*handle = next;
lua_pushcclosure(L, windows_iter, 1);
return 1;
}
Expand All @@ -628,9 +629,11 @@ static int windows_iter(lua_State *L) {
Win **handle = lua_touserdata(L, lua_upvalueindex(1));
if (!*handle)
return 0;
Win *win = obj_ref_new(L, *handle, VIS_LUA_TYPE_WINDOW);
if (win)
*handle = win->next;
Win *win = obj_ref_new(L, *handle, VIS_LUA_TYPE_WINDOW), *next;
if (win) {
for (next = win->next; next && next->file->internal; next = next->next);
*handle = next;
}
return 1;
}

Expand Down

0 comments on commit 2d4aebd

Please sign in to comment.