@@ -228,6 +228,7 @@ M.fzf_resume = function(opts)
228228 return
229229 end
230230 opts = utils .tbl_deep_extend (" force" , config .__resume_data .opts , opts or {})
231+ utils .set_info (opts .__INFO ) -- restore original picker info
231232 assert (opts == config .__resume_data .opts )
232233 opts .cwd = opts .cwd and libuv .expand (opts .cwd ) or nil
233234 M .fzf_wrap (config .__resume_data .contents , config .__resume_data .opts )
@@ -329,30 +330,9 @@ M.fzf = function(contents, opts)
329330 if previewer then
330331 -- Attach the previewer to the windows
331332 fzf_win :attach_previewer (previewer )
332- -- Set the preview command line
333- opts .preview = previewer :cmdline ()
334- -- fzf 0.40 added 'zero' event for when there's no match
335- -- clears the preview when there are no matching entries
336- if utils .has (opts , " fzf" , { 0 , 40 }) and previewer .zero then
337- table.insert (opts ._fzf_cli_args , " --bind="
338- .. libuv .shellescape (" zero:+" .. previewer :zero ()))
339- end
340- if type (previewer .preview_window ) == " function" then
341- -- do we need to override the preview_window args?
342- -- this can happen with the builtin previewer
343- -- (1) when using a split we use the previewer as placeholder
344- -- (2) we use 'nohidden:right:0' to trigger preview function
345- -- calls without displaying the native fzf previewer split
346- opts .fzf_opts [" --preview-window" ] = previewer :preview_window ()
347- end
348- -- provides preview offset when using native previewers
349- -- (bat/cat/etc) with providers that supply line numbers
350- -- (grep/quickfix/LSP)
351- if type (previewer .fzf_delimiter ) == " function" then
352- opts .fzf_opts [" --delimiter" ] = previewer :fzf_delimiter ()
353- end
354- if opts .preview_offset == nil and type (previewer ._preview_offset ) == " function" then
355- opts .preview_offset = previewer :_preview_offset ()
333+ -- Setup --preview/--preview-window/--bind=zero:... etc
334+ if type (previewer .setup_opts ) == " function" then
335+ opts = previewer :setup_opts (opts )
356336 end
357337 elseif opts .preview and type (opts .preview ) ~= " string" then
358338 opts .preview = require (" fzf-lua.previewer" ).normalize_spec (opts .preview , opts )
0 commit comments