1
This commit is contained in:
Alex Yatskov 2024-05-04 11:40:50 -07:00
parent 710c9fad4e
commit 48d807a0a1

View File

@ -236,7 +236,6 @@ function Param.new(pair, opt)
offset = nil,
start = nil,
stop = nil,
terminator = nil,
}
return setmetatable(param, Param)
@ -259,13 +258,6 @@ function Param:append(char, cursor)
self.stop = cursor
end
function Param:terminate(cursor)
self.terminator = cursor
if self.terminator == Cursor.get_current() then
self.offset = #self.text
end
end
function Param:is_active()
return self.offset ~= nil
end
@ -342,12 +334,8 @@ function ParamList.new(range, opt)
return setmetatable(params, ParamList)
end
function ParamList:flush(cursor)
function ParamList:flush()
if self.current then
if cursor then
self.current:terminate(cursor)
end
if self.current:trim() then
table.insert(self.parsed, self.current)
end
@ -360,7 +348,7 @@ function ParamList:update(char, brace_stack, cursor)
if not cursor:is_literal() then
brace_stack:update(char)
if brace_stack:empty() and char == ',' then
self:flush(cursor)
self:flush()
return
end
end
@ -646,11 +634,7 @@ function WrapContext:object_a()
if param then
param.start:set_current()
vim.cmd.normal('v')
if param.terminator then
param.terminator:set_current()
else
param.stop:set_current()
end
param.stop:set_current()
end
end