placeholder on focus no text
This commit is contained in:
@@ -2638,8 +2638,8 @@ function Element:draw(backdropCanvas)
|
|||||||
local isPlaceholder = false
|
local isPlaceholder = false
|
||||||
local isPasswordMasked = false
|
local isPasswordMasked = false
|
||||||
|
|
||||||
-- Show placeholder if editable, empty, and not focused
|
-- Show placeholder if editable and empty
|
||||||
if self.editable and (not displayText or displayText == "") and self.placeholder and not self._focused then
|
if self.editable and (not displayText or displayText == "") and self.placeholder then
|
||||||
displayText = self.placeholder
|
displayText = self.placeholder
|
||||||
isPlaceholder = true
|
isPlaceholder = true
|
||||||
end
|
end
|
||||||
@@ -4044,8 +4044,8 @@ function Element:moveCursorToPreviousWord()
|
|||||||
|
|
||||||
-- Skip any whitespace/punctuation before current position
|
-- Skip any whitespace/punctuation before current position
|
||||||
while pos > 0 do
|
while pos > 0 do
|
||||||
local offset = utf8.offset(text, pos)
|
local offset = utf8.offset(text, pos + 1)
|
||||||
local char = offset and text:sub(offset, utf8.offset(text, pos + 1) - 1) or ""
|
local char = offset and text:sub(offset, utf8.offset(text, pos + 2) - 1) or ""
|
||||||
if char:match("[%w]") then
|
if char:match("[%w]") then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
@@ -4054,9 +4054,11 @@ function Element:moveCursorToPreviousWord()
|
|||||||
|
|
||||||
-- Move to start of current word
|
-- Move to start of current word
|
||||||
while pos > 0 do
|
while pos > 0 do
|
||||||
local offset = utf8.offset(text, pos)
|
local offset = utf8.offset(text, pos + 1)
|
||||||
local char = offset and text:sub(offset, utf8.offset(text, pos + 1) - 1) or ""
|
local char = offset and text:sub(offset, utf8.offset(text, pos + 2) - 1) or ""
|
||||||
if not char:match("[%w]") then
|
if not char:match("[%w]") then
|
||||||
|
-- We've moved one position past the start, so move back
|
||||||
|
pos = pos + 1
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
pos = pos - 1
|
pos = pos - 1
|
||||||
|
|||||||
Reference in New Issue
Block a user