Skip to content

Commit 52b3523

Browse files
committed
Fixed font filtering blocking newlines in multi-line fields.
1 parent 42b0acc commit 52b3523

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

InputField.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
--============================================================]]
135135

136136
local InputField = {
137-
_VERSION = "InputField 3.3.0",
137+
_VERSION = "InputField 3.3.0-dev",
138138
}
139139

140140

@@ -225,14 +225,17 @@ end
225225

226226

227227
local function cleanString(field, s)
228-
s = s:gsub((field:isMultiline() and "[%z\1-\9\11-\31]+" or "[%z\1-\31]+"), "") -- Should we allow horizontal tab?
228+
local isMultiline = field:isMultiline()
229+
s = s:gsub((isMultiline and "[%z\1-\9\11-\31]+" or "[%z\1-\31]+"), "") -- Should we allow horizontal tab?
229230

230231
if field.fontFilteringIsActive then
231232
local font = field.font
232233
local hasGlyphs = font.hasGlyphs
233234

234235
s = s:gsub(utf8.charpattern, function(c)
235-
if not hasGlyphs(font, c) then return "" end
236+
if not (hasGlyphs(font, c) or (c == "\n" and isMultiline)) then
237+
return ""
238+
end
236239
end)
237240
end
238241

0 commit comments

Comments
 (0)