diff --git a/POPUP.md b/POPUP.md index 6e3ffc8e..0721f1af 100644 --- a/POPUP.md +++ b/POPUP.md @@ -14,8 +14,6 @@ this and expose the API in vimL to create better compatibility. ## List of Neovim Features Required: -- [ ] Add Z-index for floating windows - - [ ] When complete, we can add `zindex` parameter - [ ] Key handlers (used for `popup_filter`) - [ ] scrollbar for floating windows - [ ] scrollbar @@ -69,6 +67,7 @@ Suported Features: - [x] time - [x] title - [x] wrap + - [x] zindex ## All known unimplemented vim features at the moment diff --git a/lua/plenary/popup/init.lua b/lua/plenary/popup/init.lua index ebfdf177..db50987e 100644 --- a/lua/plenary/popup/init.lua +++ b/lua/plenary/popup/init.lua @@ -92,6 +92,7 @@ function popup.create(what, vim_options) local option_defaults = { posinvert = true, + zindex = 50, } local win_opts = {} @@ -198,6 +199,11 @@ function popup.create(what, vim_options) -- textpropwin -- textpropid + -- zindex, Priority for the popup, default 50. Minimum value is + -- , 1, maximum value is 32000. + local zindex = dict_default(vim_options, "zindex", option_defaults) + win_opts.zindex = utils.bounded(zindex, 1, 32000) + -- noautocmd, undocumented vim default per https://github.com/vim/vim/issues/5737 win_opts.noautocmd = vim.F.if_nil(vim_options.noautocmd, true) diff --git a/lua/plenary/window/border.lua b/lua/plenary/window/border.lua index a4fd865e..de4d43f1 100644 --- a/lua/plenary/window/border.lua +++ b/lua/plenary/window/border.lua @@ -188,6 +188,7 @@ function Border:new(content_bufnr, content_win_id, content_win_options, border_w col = content_win_options.col - thickness.left, width = content_win_options.width + thickness.left + thickness.right, height = content_win_options.height + thickness.top + thickness.bot, + zindex = content_win_options.zindex or 50, noautocmd = content_win_options.noautocmd, })