From d4eeba39c561ae719ba64d881ea426120f1b313d Mon Sep 17 00:00:00 2001 From: Jeremy Bobbin Date: Thu, 16 Feb 2023 18:49:37 -0800 Subject: implement Selection:remove() --- vis-lua.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'vis-lua.c') diff --git a/vis-lua.c b/vis-lua.c index 24b911e..9bf5629 100644 --- a/vis-lua.c +++ b/vis-lua.c @@ -2057,10 +2057,23 @@ static int window_selection_to(lua_State *L) { return 0; } +/*** + * Remove selection. + * @function remove + */ +static int window_selection_remove(lua_State *L) { + Selection *sel = obj_lightref_check(L, 1, VIS_LUA_TYPE_SELECTION); + if (sel) { + view_selections_dispose(sel); + } + return 0; +} + static const struct luaL_Reg window_selection_funcs[] = { { "__index", window_selection_index }, { "__newindex", window_selection_newindex }, { "to", window_selection_to }, + { "remove", window_selection_remove }, { NULL, NULL }, }; -- cgit v1.2.3