Skip to content

Commit b6970ad

Browse files
committed
WIP: alternative for PR 1871
1 parent 54005a6 commit b6970ad

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

lua/fzf-lua/profiles/hide.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ return {
8282
end
8383
return act
8484
end, opts.actions)
85+
-- Hijack the resize event to reload buffer/tab list on unhide
86+
opts.keymap.fzf.resize = function()
87+
if opts._unhide_called then
88+
_G.dump("call opts", opts.__call_opts)
89+
end
90+
opts._unhide_called = nil
91+
end
8592
return opts
8693
end,
8794
},

lua/fzf-lua/utils.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,8 +797,8 @@ function M.fzf_winobj()
797797
return loadstring("return require'fzf-lua'.win.__SELF()")()
798798
end
799799

800-
function M.CTX()
801-
return loadstring("return require'fzf-lua'.core.CTX()")()
800+
function M.CTX(...)
801+
return loadstring("return require'fzf-lua'.core.CTX(...)")(...)
802802
end
803803

804804
function M.__CTX()

lua/fzf-lua/win.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
local path = require "fzf-lua.path"
22
local utils = require "fzf-lua.utils"
3+
local libuv = require "fzf-lua.libuv"
34
local config = require "fzf-lua.config"
45
local actions = require "fzf-lua.actions"
56

@@ -1211,7 +1212,12 @@ end
12111212
function FzfWin.unhide()
12121213
local self = _self
12131214
if not self or not self:hidden() then return end
1214-
self._o.__CTX = utils.CTX()
1215+
self._o.__CTX = utils.CTX({ includeBuflist = true })
1216+
self._o._unhide_called = true
1217+
-- Send SIGWINCH to to trigger resize in the fzf process
1218+
-- We will use the trigger to reload necessary buffer lists
1219+
local pid = fn.jobpid(vim.bo[self._hidden_fzf_bufnr].channel)
1220+
vim.tbl_map(function(_pid) libuv.process_kill(_pid, 28) end, vim._os_proc_children(pid))
12151221
vim.bo[self._hidden_fzf_bufnr].bufhidden = "wipe"
12161222
self.fzf_bufnr = self._hidden_fzf_bufnr
12171223
self._hidden_fzf_bufnr = nil

0 commit comments

Comments
 (0)