|
|
|
@ -10,6 +10,7 @@ local ParseTable = require('libmodal/src/collections/ParseTable')
|
|
|
|
|
local utils = require('libmodal/src/utils')
|
|
|
|
|
local Vars = require('libmodal/src/Vars')
|
|
|
|
|
|
|
|
|
|
local vim = vim
|
|
|
|
|
local api = vim.api
|
|
|
|
|
|
|
|
|
|
--[[
|
|
|
|
@ -199,14 +200,21 @@ function _metaMode:_inputLoop()
|
|
|
|
|
-- Set the global input variable to the new input.
|
|
|
|
|
self.input:nvimSet(userInput)
|
|
|
|
|
|
|
|
|
|
-- Make sure that the user doesn't want to exit.
|
|
|
|
|
if not self.exit.supress
|
|
|
|
|
and userInput == globals.ESC_NR then return false
|
|
|
|
|
-- If the second argument was a dict, parse it.
|
|
|
|
|
elseif type(self._instruction) == globals.TYPE_TBL then
|
|
|
|
|
self:_checkInputForMapping()
|
|
|
|
|
else -- the second argument was a function; execute it.
|
|
|
|
|
self._instruction()
|
|
|
|
|
if not self.exit.supress and userInput == globals.ESC_NR then -- The user wants to exit.
|
|
|
|
|
return false -- As in, "I don't want to continue."
|
|
|
|
|
else -- The user wants to continue.
|
|
|
|
|
|
|
|
|
|
--[[ The instruction type is determined every cycle, because the user may be assuming a more direct control
|
|
|
|
|
over the instruction and it may change over the course of execution. ]]
|
|
|
|
|
local instructionType = type(self._instruction)
|
|
|
|
|
|
|
|
|
|
if instructionType == globals.TYPE_TBL then -- The second argument was a dict. Parse it.
|
|
|
|
|
self:_checkInputForMapping()
|
|
|
|
|
elseif instructionType == globals.TYPE_STR and vim.fn then -- It is the name of a VimL function. This only works in Neovim 0.5+.
|
|
|
|
|
vim.fn[self._instruction]()
|
|
|
|
|
else -- the second argument was a function; execute it.
|
|
|
|
|
self._instruction()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return true
|
|
|
|
|