Prevent textinput.alltextselected from being set to true when the object contains no text

This commit is contained in:
Kenny Shields 2014-05-17 17:21:33 -04:00
parent c674b46a0c
commit eb4b5598f0

View File

@ -355,8 +355,14 @@ function newobject:mousepressed(x, y, button)
if not alltextselected then
local lastclicktime = self.lastclicktime
if (time > lastclicktime) and time < (lastclicktime + 0.25) then
if not self.multiline then
if self.lines[1] ~= "" then
self.alltextselected = true
end
else
self.alltextselected = true
end
end
else
self.alltextselected = false
end
@ -463,7 +469,13 @@ function newobject:keypressed(key, isrepeat)
if (loveframes.util.IsCtrlDown()) and focus then
if key == "a" then
if not self.multiline then
if self.lines[1] ~= "" then
self.alltextselected = true
end
else
self.alltextselected = true
end
elseif key == "c" and alltextselected then
local text = self:GetText()
local oncopy = self.OnCopy