From 450dc2df6a3b6443e372dc86cbefc8fede71b54d Mon Sep 17 00:00:00 2001 From: Alexey Yerin Date: Sun, 27 Aug 2023 21:38:48 +0300 Subject: Make tabwidth option window-local --- vis-lua.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'vis-lua.c') diff --git a/vis-lua.c b/vis-lua.c index bee077c..c3d3128 100644 --- a/vis-lua.c +++ b/vis-lua.c @@ -1553,8 +1553,6 @@ static int vis_options_assign(Vis *vis, lua_State *L, const char *key, int next) if (!lua_isstring(L, next)) return newindex_common(L); vis_shell_set(vis, lua_tostring(L, next)); - } else if (strcmp(key, "tabwidth") == 0 || strcmp(key, "tw") == 0) { - vis_tabwidth_set(vis, luaL_checkint(L, next)); } return 0; } @@ -1663,7 +1661,6 @@ static const struct luaL_Reg vis_lua[] = { * @tfield[opt=false] boolean ignorecase {ic} * @tfield[opt="auto"] string loadmethod `"auto"`, `"read"`, or `"mmap"`. * @tfield[opt="/bin/sh"] string shell - * @tfield[opt=8] int tabwidth {tw} */ static int vis_options_index(lua_State *L) { @@ -1704,9 +1701,6 @@ static int vis_options_index(lua_State *L) { } else if (strcmp(key, "shell") == 0) { lua_pushstring(L, vis->shell); return 1; - } else if (strcmp(key, "tabwidth") == 0 || strcmp(key, "tw") == 0) { - lua_pushinteger(L, vis->tabwidth); - return 1; } } return index_common(L); @@ -1971,6 +1965,8 @@ static int window_options_assign(Win *win, lua_State *L, const char *key, int ne view_options_set(win->view, flags); } else if (strcmp(key, "wrapcolumn") == 0 || strcmp(key, "wc") == 0) { view_wrapcolumn_set(win->view, luaL_checkint(L, next)); + } else if (strcmp(key, "tabwidth") == 0 || strcmp(key, "tw") == 0) { + view_tabwidth_set(win->view, luaL_checkint(L, next)); } return 0; } @@ -2180,6 +2176,7 @@ static const struct luaL_Reg window_funcs[] = { * @tfield[opt=false] boolean showspaces * @tfield[opt=false] boolean showtabs * @tfield[opt=0] int wrapcolumn {wc} + * @tfield[opt=8] int tabwidth {tw} */ static int window_options_index(lua_State *L) { @@ -2218,6 +2215,9 @@ static int window_options_index(lua_State *L) { } else if (strcmp(key, "wrapcolumn") == 0 || strcmp(key, "wc") == 0) { lua_pushunsigned(L, view_wrapcolumn_get(win->view)); return 1; + } else if (strcmp(key, "tabwidth") == 0 || strcmp(key, "tw") == 0) { + lua_pushinteger(L, view_tabwidth_get(win->view)); + return 1; } } return index_common(L); -- cgit v1.2.3