Skip to content

Commit f1c783e

Browse files
authored
feat: add options for popup being focusable (#216)
1 parent 091d133 commit f1c783e

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lua/plenary/popup/init.lua

+5
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ function popup.create(what, vim_options)
201201
-- noautocmd, undocumented vim default per https://github.com/vim/vim/issues/5737
202202
win_opts.noautocmd = vim.F.if_nil(vim_options.noautocmd, true)
203203

204+
-- focusable,
205+
-- vim popups are not focusable windows
206+
win_opts.focusable = vim.F.if_nil(vim_options.focusable, false)
207+
204208
local win_id
205209
if vim_options.hidden then
206210
assert(false, "I have not implemented this yet and don't know how")
@@ -346,6 +350,7 @@ function popup.create(what, vim_options)
346350

347351
local border = nil
348352
if should_show_border then
353+
border_options.focusable = vim_options.border_focusable
349354
border = Border:new(bufnr, win_id, win_opts, border_options)
350355
end
351356

lua/plenary/window/border.lua

+1
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ function Border:new(content_bufnr, content_win_id, content_win_options, border_w
189189
width = content_win_options.width + thickness.left + thickness.right,
190190
height = content_win_options.height + thickness.top + thickness.bot,
191191
noautocmd = content_win_options.noautocmd,
192+
focusable = vim.F.if_nil(border_win_options.focusable, false),
192193
})
193194

194195
vim.cmd(

0 commit comments

Comments
 (0)