|
|
|
@ -38,23 +38,23 @@ local _metaPopup = require('libmodal/src/classes').new(Popup.TYPE)
|
|
|
|
|
|
|
|
|
|
---------------------------
|
|
|
|
|
--[[ SUMMARY:
|
|
|
|
|
* Close `self._window`
|
|
|
|
|
* Close `self.window`
|
|
|
|
|
* The `self` is inert after calling this.
|
|
|
|
|
]]
|
|
|
|
|
---------------------------
|
|
|
|
|
function _metaPopup:close()
|
|
|
|
|
api.nvim_win_close(self._window, false)
|
|
|
|
|
api.nvim_win_close(self.window, false)
|
|
|
|
|
|
|
|
|
|
self._buffer = nil
|
|
|
|
|
self.buffer = nil
|
|
|
|
|
self._inputChars = nil
|
|
|
|
|
self._window = nil
|
|
|
|
|
self.window = nil
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---------------------------------
|
|
|
|
|
---------------------------------------
|
|
|
|
|
--[[ SUMMARY:
|
|
|
|
|
* Update `buffer` with the latest user `inputBytes`.
|
|
|
|
|
]]
|
|
|
|
|
---------------------------------
|
|
|
|
|
---------------------------------------
|
|
|
|
|
function _metaPopup:refresh(inputBytes)
|
|
|
|
|
local inputBytesLen = #inputBytes
|
|
|
|
|
local inputChars = self._inputChars
|
|
|
|
@ -73,7 +73,7 @@ function _metaPopup:refresh(inputBytes)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
api.nvim_buf_set_lines(
|
|
|
|
|
self._buffer, 0, 1, true,
|
|
|
|
|
self.buffer, 0, 1, true,
|
|
|
|
|
{table.concat(self._inputChars)}
|
|
|
|
|
)
|
|
|
|
|
end
|
|
|
|
@ -86,13 +86,12 @@ end
|
|
|
|
|
|
|
|
|
|
function Popup.new()
|
|
|
|
|
local buf = api.nvim_create_buf(false, true)
|
|
|
|
|
local Popup = require('libmodal/src/Mode/Popup')
|
|
|
|
|
|
|
|
|
|
return setmetatable(
|
|
|
|
|
{
|
|
|
|
|
['_buffer'] = buf,
|
|
|
|
|
['buffer'] = buf,
|
|
|
|
|
['_inputChars'] = {},
|
|
|
|
|
['_window'] = api.nvim_call_function(
|
|
|
|
|
['window'] = api.nvim_call_function(
|
|
|
|
|
'nvim_open_win', {buf, false, Popup.config}
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|