Works great - but only on the default font. For any font that is not default, the cursor is always misplaced. I suspect it is doing a character count and placing the cursor assuming a fixed width character, which obviously fails when changing fonts.
I've looked into the code and it's a level higher than my current knowledge. I've attached a working project hoping someone can work out how to make it work with any font size. I'm thinking the issue is on line 1133 where it literally counts the number of characters without any regard to font:
Code: Select all
-- length = field:getTextLength( )
-- Returns the number of characters in the UTF-8 text string.
function InputField.getTextLength(field)
return utf8.len(field.text)
end