vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit b86e49eb64891f0fdcf83470de655107f5af622d parent c4c10d3dd69965b72fa13b42fbdc112e8cba1c53 Author: Jeremy Bobbin <jer@jer.cx> Date: Thu, 16 Feb 2023 18:49:37 -0800 implement Selection:remove() Diffstat:
| M | CHANGELOG.md | | | 1 | + |
| M | vis-lua.c | | | 13 | +++++++++++++ |
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git 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 @@ -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 }, };