1
This commit is contained in:
Alex Yatskov 2024-05-01 20:20:50 -07:00
parent d06d6865df
commit 170dccdaa9

View File

@ -223,22 +223,23 @@ end
local Param = {} local Param = {}
Param.__index = Param Param.__index = Param
function Param.new(text, pair) function Param.new(pair)
local param = { local param = {
text = text, cursors = {},
pair = pair,
offset = nil, offset = nil,
pair = pair,
text = '',
} }
return setmetatable(param, Param) return setmetatable(param, Param)
end end
function Param:append(char) function Param:append(char, cursor)
self.text = self.text .. char self.text = self.text .. char
end table.insert(self.cursors, cursor)
if cursor == Cursor.get_current() then
function Param:activate()
self.offset = #self.text self.offset = #self.text
end
end end
function Param:is_active() function Param:is_active()
@ -296,15 +297,11 @@ function ParamList:update(char, brace_stack, cursor)
end end
end end
if self.current then if not self.current then
self.current:append(char) self.current = Param.new(self.range)
else
self.current = Param.new(char, self.range)
end end
if cursor == Cursor.get_current() then self.current:append(char, cursor)
self.current:activate()
end
end end
function ParamList:parse() function ParamList:parse()