diff --git a/doc/libmodal-lua.txt b/doc/libmodal-lua.txt index 1fe53f8..93a498c 100644 --- a/doc/libmodal-lua.txt +++ b/doc/libmodal-lua.txt @@ -608,6 +608,16 @@ want to for their mode specifically. > ------------------------------------------------------------------------------ functions *libmodal-lua-Mode-functions* +`self`.exit *libmodal-lua-Mode.exit* + + A liason to the `g:`{name}`ModeExit` variable. + + Type: ~ + `libmodal.Vars` + + Value: ~ + `libmodal.Vars.new('exit', `{name}`)` + `self`.indicator *libmodal-lua-Mode.indicator* The message that is shown in the bottom-left corner of the screen while the diff --git a/lua/libmodal/src/Mode/init.lua b/lua/libmodal/src/Mode/init.lua index 3803f12..c693512 100644 --- a/lua/libmodal/src/Mode/init.lua +++ b/lua/libmodal/src/Mode/init.lua @@ -181,8 +181,8 @@ end ------------------------------- function _metaMode:_inputLoop() -- If the mode is not handling exit events automatically and the global exit var is true. - if self._exit.supress - and globals.is_true(self._exit:nvimGet()) + if self.exit.supress + and globals.is_true(self.exit:nvimGet()) then return false end @@ -202,7 +202,7 @@ function _metaMode:_inputLoop() self.input:nvimSet(userInput) -- Make sure that the user doesn't want to exit. - if not self._exit.supress + 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 @@ -251,9 +251,9 @@ function Mode.new(name, instruction, ...) -- Inherit the metatable. local self = setmetatable( { - ['_exit'] = Vars.new('exit', name), + ['exit'] = Vars.new('exit', name), ['indicator'] = Indicator.mode(name), - ['_input'] = Vars.new('input', name), + ['input'] = Vars.new('input', name), ['_instruction'] = instruction, ['_name'] = name, ['_winState'] = utils.WindowState.new(), @@ -262,7 +262,7 @@ function Mode.new(name, instruction, ...) ) -- Define the exit flag - self._exit.supress = (function(optionalValue) + self.exit.supress = (function(optionalValue) if optionalValue then return globals.is_true(optionalValue) else