Skip to content

Commit a3508e8

Browse files
phanenibhagwan
authored andcommitted
fix(cli): serverlist previewer don't work when headless instance have float window
openpty is used to avoid some bug in upstream (some weird crash) but it seems no longer reproduce now
1 parent 65082af commit a3508e8

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

lua/fzf-lua/previewer/fzf.lua

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -537,25 +537,23 @@ local function make_screenshot(screenshot, addr, lines, columns)
537537
end)
538538
]], { lines, columns, screenshot })
539539
end
540-
local jobstart = _G.fzf_pty_spawn or vim.fn.jobstart
541540
local nvim_bin = os.getenv("FZF_LUA_NVIM_BIN") or vim.v.progpath
542-
local chan = jobstart({ nvim_bin, "--server", addr, "--remote-ui" }, {
541+
local chan = vim.fn.jobstart({ nvim_bin, "--server", addr, "--remote-ui" }, {
543542
pty = true,
544543
height = lines,
545544
width = columns,
546545
env = {
547546
TERM = "xterm-256color",
548-
VIMRUNTIME = vim.env.VIMRUNTIME,
547+
VIMRUNTIME = os.getenv("VIMRUNTIME"),
549548
},
550549
on_stdout = function(chan0)
551550
if closing then return end
552551
closing = true
553552
vim.defer_fn(function() utils.rpcexec(addr, "nvim__screenshot", screenshot) end, 10)
554-
if not _G.fzf_pty_spawn then vim.defer_fn(function() vim.fn.jobstop(chan0) end, 20) end
553+
vim.defer_fn(function() vim.fn.jobstop(chan0) end, 20)
555554
end,
556555
})
557-
if not _G.fzf_pty_spawn then return vim.fn.jobpid(chan) end
558-
return chan
556+
return vim.fn.jobpid(chan)
559557
end
560558

561559
function Previewer.nvim_server:cmdline(_)

0 commit comments

Comments
 (0)