Skip to content

Commit 491b088

Browse files
committed
fix(global): line_query should be processed last
1 parent 118d9e4 commit 491b088

4 files changed

Lines changed: 9 additions & 16 deletions

File tree

lua/fzf-lua/actions.lua

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ end
9898

9999
M.act = function(selected, opts)
100100
if not selected then return end
101-
if opts.__alt_opts then
102-
opts.__alt_opts.last_query = opts.last_query
103-
opts.__alt_opts.__INFO = opts.__INFO
104-
end
105101
local actions = opts.actions
106102
local keybind, entries = M.normalize_selected(selected, opts)
107103
-- fzf >= 0.53 and `--exit-0`
@@ -116,10 +112,10 @@ M.act = function(selected, opts)
116112
-- (1) map containing action properties (reload, noclose, etc)
117113
-- (2) array of actions to be executed serially
118114
if action.fn then
119-
action.fn(entries, opts.__alt_opts or opts)
115+
action.fn(entries, opts)
120116
else
121117
for _, f in ipairs(action) do
122-
f(entries, opts.__alt_opts or opts)
118+
f(entries, opts)
123119
end
124120
end
125121
elseif type(action) == "function" then

lua/fzf-lua/path.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,8 @@ end
416416
---@param force_uri boolean?
417417
---@return fzf-lua.path.Entry
418418
function M.entry_to_file(entry, opts, force_uri)
419-
opts = opts or {}
419+
-- NOTE: see note in meta.lua:global regarding alt options
420+
opts = opts and opts.__alt_opts or opts or {}
420421
if opts._fmt then
421422
if type(opts._fmt._from) == "function" then
422423
entry = opts._fmt._from(entry, opts)

lua/fzf-lua/profiles/hide.lua

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,11 @@ return {
6767
act.exec_silent = true
6868
act.desc = act.desc or fzf.config.get_action_helpstr(fn)
6969
act.fn = function(...)
70-
local sel = select(1, ...)
71-
local o = select(2, ...)
72-
if o.__alt_opts then
73-
o.__alt_opts.last_query = o.last_query
74-
o.__alt_opts.__INFO = o.__INFO
75-
end
7670
fzf.hide()
77-
fn(sel, o.__alt_opts or o)
71+
fn(...)
7872
-- As the process never terminates fzf history is never written
7973
-- manually append to the fzf history file if needed
74+
local o = select(2, ...)
8075
if histfile and type(o.last_query) == "string" and #o.last_query > 0 then
8176
local fd = uv.fs_open(histfile, "a", -1)
8277
if fd then

lua/fzf-lua/providers/meta.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,11 @@ M.global = function(opts)
229229
end, opts, "{q}")
230230
end
231231

232-
table.insert(opts._fzf_cli_args, "--bind="
232+
-- Insert at the start of the args table so `line_query` callback is first
233+
table.insert(opts._fzf_cli_args, 1, "--bind="
233234
.. libuv.shellescape("start:+transform:" .. transform_picker(true)))
234235

235-
table.insert(opts._fzf_cli_args, "--bind="
236+
table.insert(opts._fzf_cli_args, 2, "--bind="
236237
.. libuv.shellescape("change:+transform:" .. transform_picker(false)))
237238

238239
if opts.header ~= false then

0 commit comments

Comments
 (0)