Skip to content

Commit ee7b523

Browse files
committed
fix(resume): **WIP** do not over "protect"
1 parent c8b5361 commit ee7b523

3 files changed

Lines changed: 19 additions & 3 deletions

File tree

lua/fzf-lua/core.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ M.fzf_exec = function(contents, opts)
155155
-- the API accepts both tables and functions which we "stringify"
156156
-- We also send string commands as stringify is also responsible
157157
-- for multiprocess wrapping of shell commands with processing
158+
opts.__stringify_protect = true
158159
contents = contents and shell.stringify(contents, opts) or nil
159160
assert(contents == nil or type(contents) == "string", "contents must be of type string")
160161
return M.fzf_wrap(contents, opts)
@@ -172,6 +173,7 @@ M.fzf_live = function(contents, opts)
172173
-- AKA "live": fzf acts as a selector only (fuzzy matching is disabled)
173174
-- each keypress reloads fzf's input usually based on the typed query
174175
-- utilizes fzf's 'change:reload' event or skim's "interactive" mode
176+
opts.__stringify_protect = true
175177
opts.fn_reload = shell.stringify(contents, opts)
176178
local fzf_field_index = M.fzf_field_index(opts)
177179
local cmd = M.expand_query(opts.fn_reload, fzf_field_index)

lua/fzf-lua/rpc.lua

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ local rpc_nvim_exec_lua = function(opts)
8282
vim.fn.chanclose(chan_id)
8383
end)
8484

85-
if not success or opts.debug then
85+
if not success or opts.debug == "v" or opts.debug == 2 then
8686
io.stderr:write(("[DEBUG] debug = %s\n"):format(opts.debug))
8787
io.stderr:write(("[DEBUG] function ID = %d\n"):format(opts.fnc_id))
8888
io.stderr:write(("[DEBUG] fzf_lua_server = %s\n"):format(opts.fzf_lua_server))
@@ -107,7 +107,18 @@ local args = vim.deepcopy(_G.arg)
107107
args[0] = nil -- remove filename
108108
local opts = {
109109
fnc_id = tonumber(table.remove(args, 1)),
110-
debug = table.remove(args, 1) == "true",
110+
debug = (function()
111+
local ret = table.remove(args, 1)
112+
if ret == "nil" then
113+
return nil
114+
elseif ret == "true" then
115+
return true
116+
elseif ret == "false" then
117+
return false
118+
else
119+
return tonumber(ret) or tostring(ret)
120+
end
121+
end)(),
111122
fzf_selection = args,
112123
fzf_lua_server = vim.env.FZF_LUA_SERVER or vim.env.SKIM_FZF_LUA_SERVER or vim.env.NVIM,
113124
}

lua/fzf-lua/shell.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,10 @@ M.stringify = function(contents, opts, fzf_field_index)
411411
end
412412
end, fzf_field_index or "", opts.debug)
413413

414-
M.set_protected(id)
414+
if opts.__stringify_protect then
415+
M.set_protected(id)
416+
end
417+
415418
return cmd, id
416419
end
417420

0 commit comments

Comments
 (0)