ref: swap `Var.new` param order

Mode name should come before var name
pull/26/head
Iron-E 3 months ago
parent f707951abd
commit 9233099a89
No known key found for this signature in database
GPG Key ID: 569E791B76A42A1A

@ -259,10 +259,10 @@ function Mode.new(name, instruction, supress_exit)
-- inherit the metatable.
local self = setmetatable(
{
count = utils.Vars.new('count', name),
count1 = utils.Vars.new('count1', name),
exit = utils.Vars.new('exit', name),
input = utils.Vars.new('input', name),
count = utils.Vars.new(name, 'count'),
count1 = utils.Vars.new(name, 'count1'),
exit = utils.Vars.new(name, 'exit'),
input = utils.Vars.new(name, 'input'),
instruction = instruction,
name = name,
ns = vim.api.nvim_create_namespace('libmodal' .. name),
@ -293,7 +293,7 @@ function Mode.new(name, instruction, supress_exit)
self.popups = require('libmodal.collections.Stack').new()
-- create a variable for whether or not timeouts are enabled.
self.timeouts = utils.Vars.new('timeouts', self.name, vim.g.libmodalTimeouts)
self.timeouts = utils.Vars.new(self.name, 'timeouts', vim.g.libmodalTimeouts)
end
return self

@ -113,9 +113,9 @@ function Prompt.new(name, instruction, user_completions)
local self = setmetatable(
{
exit = utils.Vars.new('exit', name),
exit = utils.Vars.new(name, 'exit'),
indicator = {hl = 'LibmodalStar', text = '* ' .. name .. ' > '},
input = utils.Vars.new('input', name),
input = utils.Vars.new(name, 'input'),
instruction = instruction,
name = name
},

@ -5,11 +5,11 @@
local Vars = require('libmodal.utils.classes').new()
--- create a new set of variables
--- @param var_name string the name of the key used to refer to this variable in `Vars`.
--- @param mode_name string the name of the mode
--- @param var_name string the name of the key used to refer to this variable in `Vars`.
--- @param default_global? unknown the default global value
--- @return libmodal.utils.Vars
function Vars.new(var_name, mode_name, default_global)
function Vars.new(mode_name, var_name, default_global)
local self = setmetatable({}, Vars)
--- @param str_with_spaces string

Loading…
Cancel
Save