Cleanup for release candidate

pull/3/head
Iron-E 4 years ago
parent 8a1486d517
commit 5d0a8be10e
No known key found for this signature in database
GPG Key ID: 19B71B7B7B021D22

@ -972,6 +972,26 @@ VARIABLES *libmodal-lua-Popup-variables*
}
<
`self`.buffer *libmodal-lua-Popup.buffer*
The scratch buffer used by `Popup` to display text.
Type: ~
|nvim_create_buf| handle.
Value: ~
`vim.api.nvim_create_buf(false, true)`
`self`.window *libmodal-lua-Popup.window*
The window used to display the contents of `Popup.buffer`.
Type: ~
|nvim_open_win| handle.
Value: ~
`vim.api.nvim_open_win(self.buffer, false, Popup.config)`
------------------------------------------------------------------------------
FUNCTIONS *libmodal-lua-Popup-functions*

@ -4,7 +4,7 @@
*/
--]]
local api = vim.api
local api = require('libmodal/src/utils/api')
--[[
/*
@ -15,8 +15,8 @@ local api = vim.api
local Layer = {['TYPE'] = 'libmodal-layer'}
local _BUFFER_CURRENT = 0
local _ERR_NO_MAP = 'E5555: API call: E31: No such mapping'
local _RESTORED = nil
local _ERR_NO_MAP = 'E5555: API call: E31: No such mapping'
local function convertKeymap(keymapEntry)
local lhs = keymapEntry.lhs
@ -82,11 +82,6 @@ function _metaLayer:enter()
end
self._priorKeymap = priorKeymap
local Popup = require('libmodal/src/collections/Popup')
-- TODO: configure `Popup.options` and add the text.
self._popup = Popup.new()
end
--------------------------------------------------------
@ -222,9 +217,6 @@ function _metaLayer:exit()
end
end
self._priorKeymap = _RESTORED
self._popup:close()
self._popup = nil
end
--[[

@ -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}
)
},

Loading…
Cancel
Save