1
This commit is contained in:
Alex Yatskov 2024-04-30 18:31:16 -07:00
parent e8dcbc6da4
commit d06d6865df

View File

@ -246,12 +246,18 @@ function Param:is_active()
end end
function Param:flush() function Param:flush()
self.text = self.text:match('^(.-)%s*$')
if self.offset then if self.offset then
self.offset = math.min(self.offset, #self.text:match('(.-)%s*$')) self.offset = math.min(self.offset, #self.text)
self.offset = math.max(self.offset - #self.text:match('^%s*'), 1) end
local length_prev = #self.text
self.text = self.text:match('^%s*(.-)$')
if self.offset then
local length_diff = length_prev - #self.text
self.offset = math.max(self.offset - length_diff, 1)
end end
self.text = self.text:match('^%s*(.-)%s*$')
return #self.text > 0 return #self.text > 0
end end