Merge pull request #5 from Iron-E/bugfix/0.6.3

Bugfix/0.6.3
pull/6/head release/0.6.3
Iron-E 4 years ago committed by GitHub
commit 075a3072bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,7 +4,8 @@
*/
--]]
local api = require('libmodal/src/utils/api')
local api = vim.api
local libmodal_api = require('libmodal/src/utils/api')
--[[
/*

@ -10,7 +10,7 @@ local ParseTable = require('libmodal/src/collections/ParseTable')
local utils = require('libmodal/src/utils')
local Vars = require('libmodal/src/Vars')
local api = utils.api
local api = vim.api
--[[
/*
@ -161,7 +161,7 @@ function _metaMode:_initMappings()
self._timeouts = Vars.new('timeouts', self._name)
-- Read the correct timeout variable.
if api.nvim_exists('g', self._timeouts:name())
if utils.api.nvim_exists('g', self._timeouts:name())
then self._timeouts.enabled =
self._timeouts:nvimGet()
else self._timeouts.enabled =
@ -186,10 +186,10 @@ function _metaMode:_inputLoop()
end
-- Echo the indicator.
api.nvim_lecho(self.indicator)
utils.api.nvim_lecho(self.indicator)
-- Capture input.
local userInput = api.nvim_input()
local userInput = utils.api.nvim_input()
-- Return if there was a timeout event.
if userInput == _TIMEOUT.NR then
@ -226,7 +226,7 @@ function _metaMode:_tearDown()
end
self._winState:restore()
api.nvim_redraw()
utils.api.nvim_redraw()
end
--[[

@ -7,7 +7,7 @@
local globals = require('libmodal/src/globals')
local utils = require('libmodal/src/utils')
local api = utils.api
local api = vim.api
--[[
/*
@ -42,7 +42,7 @@ local _metaPrompt = require('libmodal/src/classes').new(Prompt.TYPE)
---------------------------------
function _metaPrompt:_inputLoop()
-- clear previous `echo`s.
api.nvim_redraw()
utils.api.nvim_redraw()
-- define a placeholder for user input
local userInput = ''
@ -72,7 +72,7 @@ function _metaPrompt:_inputLoop()
elseif userInput == _HELP then -- the user did not define a 'help' command, so use the default.
self._help:show()
else -- show an error.
api.nvim_show_err(globals.DEFAULT_ERROR_TITLE, 'Unknown command')
utils.api.nvim_show_err(globals.DEFAULT_ERROR_TITLE, 'Unknown command')
end
else -- attempt to call the instruction.
instruction()

@ -4,7 +4,8 @@
*/
--]]
local api = require('libmodal/src/utils/api')
local api = vim.api
local libmodal_api = require('libmodal/src/utils/api')
--[[
/*
@ -33,7 +34,7 @@ local _metaWindowState = require('libmodal/src/classes').new(WindowState.TYPE)
function _metaWindowState:restore()
api.nvim_set_option(height, self.height)
api.nvim_set_option(width, self.width)
api.nvim_redraw()
libmodal_api.nvim_redraw()
end
--[[

@ -4,7 +4,8 @@
*/
--]]
local api = vim.api
local api = {}
local vim_api = vim.api
------------------------
--[[ SUMMARY:
@ -12,7 +13,7 @@ local api = vim.api
]]
------------------------
function api.nvim_bell()
api.nvim_command('normal ' .. string.char(27)) -- escape char
vim_api.nvim_command('normal '..string.char(27)) -- escape char
end
------------------------------------
@ -25,7 +26,7 @@ end
]]
------------------------------------
function api.nvim_exists(scope, var)
return api.nvim_call_function('exists', {scope .. ':' .. var}) == require('libmodal/src/globals').VIM_TRUE
return vim_api.nvim_call_function('exists', {scope..':'..var}) == require('libmodal/src/globals').VIM_TRUE
end
-------------------------
@ -53,7 +54,17 @@ end
]]
-------------------------
function api.nvim_input()
return api.nvim_call_function('getchar', {})
return vim_api.nvim_call_function('getchar', {})
end
--------------------------
--[[ SUMMARY:
* Run `mode` to refresh the screen.
* The function was not named `nvim_mode` because that would be really confusing given the name of this plugin.
]]
--------------------------
function api.nvim_redraw()
vim_api.nvim_command('mode')
end
---------------------------------
@ -79,19 +90,9 @@ function api.nvim_lecho(hlTables)
lecho_template[2] = tostring(hlTable.hl)
lecho_template[4] = tostring(hlTable.str)
api.nvim_command(table.concat(lecho_template))
vim_api.nvim_command(table.concat(lecho_template))
end
api.nvim_command('echohl None')
end
--------------------------
--[[ SUMMARY:
* Run `mode` to refresh the screen.
* The function was not named `nvim_mode` because that would be really confusing given the name of this plugin.
]]
--------------------------
function api.nvim_redraw()
api.nvim_command('mode')
vim_api.nvim_command('echohl None')
end
--------------------------------------
@ -107,10 +108,10 @@ end
function api.nvim_show_err(title, msg)
local HighlightSegment = require('libmodal/src/Indicator/HighlightSegment')
api.nvim_lecho({
HighlightSegment.new('Title', tostring(title) .. '\n'),
HighlightSegment.new('Title', tostring(title)..'\n'),
HighlightSegment.new('Error', tostring(msg)),
})
api.nvim_call_function('getchar', {})
vim_api.nvim_call_function('getchar', {})
end
--[[

@ -24,11 +24,11 @@ utils.WindowState = require('libmodal/src/utils/WindowState')
]]
----------------------------------
function utils.show_error(pcall_err)
local api = utils.api
local api = vim.api
api.nvim_bell()
utils.api.nvim_bell()
api.nvim_show_err(
utils.api.nvim_show_err(
require('libmodal/src/globals').DEFAULT_ERROR_TITLE,
api.nvim_get_vvar('throwpoint')
.. '\n' ..

Loading…
Cancel
Save