aboutsummaryrefslogtreecommitdiff
path: root/vis-lua.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-11-17 12:29:38 +0100
committerMarc André Tanner <mat@brain-dump.org>2017-11-21 10:52:33 +0100
commit2d4aebd7d2d13024b56edf35188f3a68c186ea41 (patch)
tree70f0b4797f56b2234c215ef4a73df5664a5b2210 /vis-lua.c
parentcb41e7e0c0209d3f1b04f57016ec674c2e26a4d5 (diff)
downloadvis-2d4aebd7d2d13024b56edf35188f3a68c186ea41.tar.gz
vis-2d4aebd7d2d13024b56edf35188f3a68c186ea41.tar.xz
vis-lua: do not enumerate internal windows
This for example skips the command prompt window.
Diffstat (limited to 'vis-lua.c')
-rw-r--r--vis-lua.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/vis-lua.c b/vis-lua.c
index 8c5e7e6..87e7f01 100644
--- a/vis-lua.c
+++ b/vis-lua.c
@@ -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;
}
@@ -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;
}