fix(Popup): don't override open() options

The window options were overriding the passed in options. We shouldn't
do that.
pull/14/head
Iron-E 3 years ago
parent 81abfff50c
commit afe38ffc20
No known key found for this signature in database
GPG Key ID: 19B71B7B7B021D22

@ -328,7 +328,7 @@ opened with the following options: >
--------------------------------------------------------------------------------
VARIABLES *libmodal-lua-Popup-variables*
`Popup`.config *libmodal-lua-Popup.apiOptions*
`Popup`.config *libmodal-lua-Popup.config*
The options used when opening a `Popup`.
@ -413,10 +413,14 @@ FUNCTIONS *libmodal-lua-Popup-functions*
{inputBytes} An array-like `table` of |char2nr|s to write to the
`Popup`.
`Popup`.new() *libmodal-lua-Popup.new()*
`Popup`.new({config}) *libmodal-lua-Popup.new()*
Create a new `Popup` and immediately open it.
Parameters: ~
{config} Same as |nvim_open_win| {config}.
          Note: defaults to |Popup.config|.
Return: ~
* A new `Popup`.

@ -85,7 +85,7 @@ function _metaPopup:open(config)
if not config then config = Popup.config end
if valid(self.window) then
config = vim.tbl_extend('force', config, api.nvim_win_get_config(self.window))
config = vim.tbl_extend('keep', config, api.nvim_win_get_config(self.window))
self:close(true)
end
@ -141,7 +141,7 @@ end
* A new popup window.
]]
--------------------
function Popup.new()
function Popup.new(config)
local buf = api.nvim_create_buf(false, true)
local self = setmetatable(
@ -152,7 +152,7 @@ function Popup.new()
_metaPopup
)
self:open()
self:open(config)
return self
end

Loading…
Cancel
Save