From 9410cdfa93608217463032c38be1b5d07e8e885b Mon Sep 17 00:00:00 2001 From: Lemmy Date: Fri, 24 Jul 2026 22:38:38 -0400 Subject: [PATCH] refactor(file-search): use closure callbacks --- file-search/panel.luau | 14 ++------------ file-search/plugin.toml | 4 ++-- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/file-search/panel.luau b/file-search/panel.luau index 55a97bf..ae7c21b 100644 --- a/file-search/panel.luau +++ b/file-search/panel.luau @@ -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 diff --git a/file-search/plugin.toml b/file-search/plugin.toml index f887d12..85eadb2 100644 --- a/file-search/plugin.toml +++ b/file-search/plugin.toml @@ -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 +