refactor(file-search): use closure callbacks

This commit is contained in:
Lemmy
2026-07-24 22:38:38 -04:00
parent 947f9d873d
commit 9410cdfa93
2 changed files with 4 additions and 14 deletions
+2 -12
View File
@@ -26,16 +26,6 @@ local render
local runSearch
local buildIndex
-- Per-row callbacks need distinct global names; the reconciler dispatches
-- callbacks by name only. getfenv() is the script environment lua_getglobal
-- reads from, so assigning into it defines the callback the host will find.
local env = getfenv()
local function rowCallback(prefix, index, fn)
local name = prefix .. "_" .. index
env[name] = fn
return name
end
local function tr(key, args)
return noctalia.tr(key, args)
end
@@ -258,9 +248,9 @@ local function resultRow(rel, index)
text = rel,
variant = "ghost",
contentAlign = "start",
onClick = rowCallback("openHit", index, function()
onClick = function()
openEntry(rel)
end),
end,
})
end
+2 -2
View File
@@ -6,8 +6,8 @@
id = "nightwatch75/file-search"
name = "File Search"
version = "0.0.10"
plugin_api = 3
version = "0.0.11"
plugin_api = 9
author = "nightwatch75"
license = "MIT"
# The exact commands the plugin spawns (fzf aside, findutils + coreutils +