make preview winodow focusable (closes #202)

main
bhagwan 3 years ago
parent 07010f74c6
commit 82cd9c15c3

@ -194,7 +194,7 @@ function Previewer.base:scroll(direction)
if preview_winid < 0 or not direction then return end
if direction == 0 then
utils.nvim_win_call(preview_winid, function()
vim.api.nvim_win_call(preview_winid, function()
-- for some reason 'nvim_win_set_cursor'
-- only moves forward, so set to (1,0) first
api.nvim_win_set_cursor(0, {1, 0})
@ -221,7 +221,7 @@ function Previewer.base:scroll(direction)
-- local input = direction > 0 and [[]] or [[]]
-- ^D = 0x04, ^U = 0x15 ('g8' on char to display)
local input = ('%c'):format(utils._if(direction>0, 0x04, 0x15))
utils.nvim_win_call(preview_winid, function()
vim.api.nvim_win_call(preview_winid, function()
vim.cmd([[norm! ]] .. input)
utils.zz()
end)

@ -390,9 +390,10 @@ function FzfWin:preview_layout()
-- only use relative when using splits
local winopts = {relative = 'editor', focusable = false, style = 'minimal'}
if self.winopts.split then
winopts = {relative = 'win', win = self.fzf_winid, focusable = false, style = 'minimal'}
winopts.relative = 'win'
end
local preview_opts = vim.tbl_extend('force', winopts, {
focusable = true,
anchor = anchor,
width = width,
height = height,

Loading…
Cancel
Save