Make lua selection percent filter create a new selection

... instead of modifying the one given as a parameter.

Also add some tests for it.
This commit is contained in:
Pasi Kallinen
2020-02-22 13:31:22 +02:00
parent 42a05e9595
commit 00a32c6039
2 changed files with 33 additions and 2 deletions

View File

@@ -299,9 +299,14 @@ l_selection_filter_percent(L)
lua_State *L;
{
struct selectionvar *sel = l_selection_check(L, 1);
struct selectionvar *ret;
int p = (int) luaL_checkinteger(L, 2);
selection_filter_percent(sel, p);
lua_settop(L, 1);
lua_pop(L, 1);
(void) l_selection_clone(L);
ret = l_selection_check(L, 1);
selection_filter_percent(ret, p);
return 1;
}