From eb4b5598f02f3e30a30465a341940cd190f6a423 Mon Sep 17 00:00:00 2001 From: Kenny Shields Date: Sat, 17 May 2014 17:21:33 -0400 Subject: [PATCH] Prevent textinput.alltextselected from being set to true when the object contains no text --- objects/textinput.lua | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/objects/textinput.lua b/objects/textinput.lua index 7cbcdde..09bf8ca 100644 --- a/objects/textinput.lua +++ b/objects/textinput.lua @@ -355,7 +355,13 @@ function newobject:mousepressed(x, y, button) if not alltextselected then local lastclicktime = self.lastclicktime if (time > lastclicktime) and time < (lastclicktime + 0.25) then - self.alltextselected = true + if not self.multiline then + if self.lines[1] ~= "" then + self.alltextselected = true + end + else + self.alltextselected = true + end end else self.alltextselected = false @@ -463,7 +469,13 @@ function newobject:keypressed(key, isrepeat) if (loveframes.util.IsCtrlDown()) and focus then if key == "a" then - self.alltextselected = true + 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