funnel all events through emit

This commit is contained in:
kepler155c@gmail.com
2019-11-13 15:17:23 -07:00
parent 0a828fecc5
commit db48031c7c
2 changed files with 18 additions and 23 deletions

View File

@@ -62,13 +62,15 @@ function Entry:copyText(cx, ex)
end
function Entry:insertText(x, text)
text = tostring(self.transform(text)) or ''
local value = _val(self.value)
if #value + #text > self.limit then
text = text:sub(1, self.limit-#value)
text = tostring(self.transform(text) or '')
if #text > 0 then
local value = _val(self.value)
if #value + #text > self.limit then
text = text:sub(1, self.limit-#value)
end
self.value = self.transform(value:sub(1, x) .. text .. value:sub(x + 1))
self.pos = self.pos + #text
end
self.value = self.transform(value:sub(1, x) .. text .. value:sub(x + 1))
self.pos = self.pos + #text
end
function Entry:deleteText(sx, ex)