[fix] InputText: fix ignoring first char when carat not in front of hint (#5052)

pull/5055/head
limerainne 5 years ago committed by Frans de Jonge
parent 1657c5e412
commit 98b681bb4f

@ -434,7 +434,11 @@ function InputText:addChars(chars)
if self.readonly or not self:isTextEditable(true) then
return
end
self.is_text_edited = true
if #self.charlist == 0 then -- widget text is empty or a hint text is displayed
self.charpos = 1 -- move cursor to the first position
end
table.insert(self.charlist, self.charpos, chars)
self.charpos = self.charpos + #util.splitToChars(chars)
self:initTextBox(table.concat(self.charlist), true)

Loading…
Cancel
Save