Stop removing edge whitespace from Integrated Circuit string input (#18494)

* Stop removing edge whitespace from IC string input

* Made sure all instances of IC strings being encoded were fixed.

* Sanitize inputs, this also allows for encoding without trimming

* Minor style fix

* Enforces 1 char limit for char pins
This commit is contained in:
NickBelmont
2025-10-25 19:41:43 -05:00
committed by GitHub
parent b1095be635
commit ef2ec0cc18
6 changed files with 8 additions and 8 deletions
@@ -154,7 +154,7 @@ list[](
var/new_data = null
switch(type_to_use)
if("string")
new_data = tgui_input_text(user, "Now type in a string.","[src] string writing", istext(default) ? default : null, MAX_NAME_LEN)
new_data = sanitizeSafe(tgui_input_text(user, "Now type in a string.","[src] string writing", istext(default) ? default : null, MAX_NAME_LEN, encode = FALSE), MAX_NAME_LEN, 1, 0)
if(istext(new_data) && holder.check_interactivity(user) )
to_chat(user, span_notice("You input [new_data] into the pin."))
return new_data
@@ -3,7 +3,7 @@
name = "char pin"
/datum/integrated_io/char/ask_for_pin_data(mob/user)
var/new_data = tgui_input_text(user, "Please type in one character.","[src] char writing")
var/new_data = sanitizeSafe(tgui_input_text(user, "Please type in one character.","[src] char writing", encode = FALSE), 1, 1, 0)
if(holder.check_interactivity(user) )
to_chat(user, span_notice("You input [new_data ? "new_data" : "NULL"] into the pin."))
write_data_to_pin(new_data)
@@ -3,8 +3,8 @@
name = "string pin"
/datum/integrated_io/string/ask_for_pin_data(mob/user)
var/new_data = tgui_input_text(user, "Please type in a string.","[src] string writing")
new_data = sanitizeSafe(new_data, MAX_MESSAGE_LEN, 0, 0)
var/new_data = tgui_input_text(user, "Please type in a string.","[src] string writing", encode = FALSE)
new_data = sanitizeSafe(new_data, MAX_MESSAGE_LEN, 1, 0)
if(new_data && holder.check_interactivity(user) )
to_chat(user, span_notice("You input [new_data ? "new_data" : "NULL"] into the pin."))
@@ -122,8 +122,8 @@
switch(type_to_use)
if("string")
accepting_refs = 0
new_data = tgui_input_text(user, "Now type in a string.","[src] string writing", null, MAX_MESSAGE_LEN)
new_data = sanitizeSafe(new_data, MAX_MESSAGE_LEN, 0, 0)
new_data = tgui_input_text(user, "Now type in a string.","[src] string writing", null, MAX_MESSAGE_LEN, encode = FALSE)
new_data = sanitizeSafe(new_data, MAX_MESSAGE_LEN, 1, 0)
if(istext(new_data) && CanInteract(user, GLOB.tgui_physical_state))
data_to_write = new_data
to_chat(user, span_notice("You set \the [src]'s memory to \"[new_data]\"."))