Text stripping
This commit is contained in:
parent
ca45fc2fdb
commit
75cc3a3cb5
@ -275,6 +275,22 @@ function Param:strip()
|
||||
self:slice(1, #self.text - #self.text:match('%s*$'))
|
||||
self:slice(1 + #self.text:match('^%s*'), #self.text)
|
||||
|
||||
local text = ''
|
||||
local cursors = {}
|
||||
|
||||
for i = 1, #self.text do
|
||||
local char = self.text:sub(i, i)
|
||||
local cursor = self.cursors[i]
|
||||
|
||||
if cursor:is_literal() or not char:match('%s') or not text:match('%s$') then
|
||||
text = text .. char
|
||||
table.insert(cursors, cursor)
|
||||
end
|
||||
end
|
||||
|
||||
self.text = text
|
||||
self.cursors = cursors
|
||||
|
||||
return #self.text > 0
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user