From ed8a78a10c6ff5737ac65a343ed195787de85bf0 Mon Sep 17 00:00:00 2001 From: Kenny Shields Date: Tue, 9 Apr 2013 10:51:00 -0400 Subject: [PATCH] Version 0.9.5.7 - Alpha (see changelog.txt) --- changelog.txt | 5 +++++ init.lua | 2 +- objects/textinput.lua | 22 ++++++++++++---------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/changelog.txt b/changelog.txt index d73fb41..374eda9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,8 @@ +================================================ +Version 0.9.5.7 - Alpha (April 9 - 2013) +================================================ +[FIXED] some issues with positioning the textinput object's text + ================================================ Version 0.9.5.6 - Alpha (March 29 - 2013) ================================================ diff --git a/init.lua b/init.lua index f6b6032..f8d69ac 100644 --- a/init.lua +++ b/init.lua @@ -9,7 +9,7 @@ loveframes = {} -- library info loveframes.info = {} loveframes.info.author = "Kenny Shields" -loveframes.info.version = "0.9.5.6" +loveframes.info.version = "0.9.5.7" loveframes.info.stage = "Alpha" -- library configurations diff --git a/objects/textinput.lua b/objects/textinput.lua index 21a45ce..869b87f 100644 --- a/objects/textinput.lua +++ b/objects/textinput.lua @@ -547,8 +547,9 @@ function newobject:RunKey(key, unicode) if indicatorx >= (self.x + swidth) and indicatornum ~= #text then local width = self.font:getWidth(text:sub(indicatornum, indicatornum)) self.offsetx = self.offsetx + width - elseif indicatornum == #text and self.offsetx ~= ((0 - font:getWidth(text)) + swidth) and font:getWidth(text) + self.textoffsetx > self.width then - self.offsetx = ((0 - font:getWidth(text)) + swidth) + elseif indicatornum == #text and self.offsetx ~= ((font:getWidth(text)) - swidth + 10) and font:getWidth(text) + self.textoffsetx > self.width then + self.offsetx = ((font:getWidth(text)) - swidth + 10) + --print(((0 - font:getWidth(text)) + swidth)) end else if indicatornum == #text then @@ -600,7 +601,7 @@ function newobject:RunKey(key, unicode) if multiline then if line > 1 and indicatornum == 0 then local newindicatornum = 0 - local oldtext = lines[line] + local oldtext = lines[line] table.remove(lines, line) self.line = line - 1 if #oldtext > 0 then @@ -613,8 +614,11 @@ function newobject:RunKey(key, unicode) end end local cwidth = font:getWidth(text:sub(#text)) - if self.offsetx ~= 0 then + if self.offsetx > 0 then self.offsetx = self.offsetx - cwidth + print(self.offsetx, cwidth) + elseif self.offsetx < 0 then + self.offsetx = 0 end end elseif key == "delete" then @@ -860,12 +864,10 @@ function newobject:RemoveFromeText(p) local line = self.line local curline = lines[line] local text = curline - local indicatornum = self.indicatornum - - local part1 = text:sub(1, p - 1) - local part2 = text:sub(p + 1) - local new = part1 .. part2 - return new + local part1 = text:sub(1, p - 1) + local part2 = text:sub(p + 1) + local new = part1 .. part2 + return new end