[MIRROR] Ports TGStation fix to text input trimming (#7973)

Co-authored-by: Runa Dacino <dacinoorder@gmail.com>
Co-authored-by: CHOMPStation2 <chompsation2@gmail.com>
This commit is contained in:
CHOMPStation2
2024-03-16 06:11:41 -07:00
committed by GitHub
parent ef2b63f759
commit 02f08bc7de
3 changed files with 14 additions and 3 deletions

View File

@@ -32,9 +32,9 @@
if(!user.client.prefs.tgui_input_mode)
if(encode)
if(multiline)
return stripped_multiline_input(user, message, title, default, max_length)
return stripped_multiline_input(user, message, title, default, PREVENT_CHARACTER_TRIM_LOSS(max_length))
else
return stripped_input(user, message, title, default, max_length)
return stripped_input(user, message, title, default, PREVENT_CHARACTER_TRIM_LOSS(max_length))
else
if(multiline)
return input(user, message, title, default) as message|null
@@ -159,4 +159,4 @@
/datum/tgui_input_text/proc/set_entry(entry)
if(!isnull(entry))
var/converted_entry = encode ? html_encode(entry) : entry
src.entry = trim(converted_entry, max_length)
src.entry = trim(converted_entry, PREVENT_CHARACTER_TRIM_LOSS(max_length))