aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Bobbin <jer@jer.cx>2023-02-16 18:49:37 -0800
committerFelix Van der Jeugt <felix.vanderjeugt@posteo.net>2023-03-19 13:51:02 +0100
commitd4eeba39c561ae719ba64d881ea426120f1b313d (patch)
tree9c910a73ee3ae03a74ec969fec2ce205a8860c36
parentc3133cc5cb329ba0787c003b6f28cb11a08b25ee (diff)
downloadvis-d4eeba39c561ae719ba64d881ea426120f1b313d.tar.gz
vis-d4eeba39c561ae719ba64d881ea426120f1b313d.tar.xz
implement Selection:remove()
-rw-r--r--CHANGELOG.md1
-rw-r--r--vis-lua.c13
2 files changed, 14 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 59e2243..bc0d310 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
- fix documentation of initial value to 'syntax' option
- fix a ~ being considered a special character in path patterns (except at the start)
- improvements to and clean-up of vis-open
+- add Selection:remove() to lua API
## [0.8] - 2022-11-01
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 },
};