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