diff --git a/code/_helpers/text.dm b/code/_helpers/text.dm index bfa7256c9fd..246d8313ed2 100644 --- a/code/_helpers/text.dm +++ b/code/_helpers/text.dm @@ -479,20 +479,23 @@ /// Used to get a properly sanitized input, of max_length /// no_trim is self explanatory but it prevents the input from being trimed if you intend to parse newlines or whitespace. /proc/stripped_input(mob/user, message = "", title = "", default = "", max_length=MAX_MESSAGE_LEN, no_trim=FALSE) - var/name = input(user, message, title, default) as text|null - + var/user_input = input(user, message, title, default) as text|null + if(isnull(user_input)) + return if(no_trim) - return copytext(html_encode(name), 1, max_length) + return copytext(html_encode(user_input), 1, max_length) else - return trim(html_encode(name), max_length) //trim is "outside" because html_encode can expand single symbols into multiple symbols (such as turning < into <) + return trim(html_encode(user_input), max_length) //trim is "outside" because html_encode can expand single symbols into multiple symbols (such as turning < into <) // Used to get a properly sanitized multiline input, of max_length /proc/stripped_multiline_input(mob/user, message = "", title = "", default = "", max_length=MAX_MESSAGE_LEN, no_trim=FALSE) - var/name = input(user, message, title, default) as message|null + var/user_input = input(user, message, title, default) as message|null + if(isnull(user_input)) + return if(no_trim) - return copytext(html_encode(name), 1, max_length) + return copytext(html_encode(user_input), 1, max_length) else - return trim(html_encode(name), max_length) + return trim(html_encode(user_input), max_length) //Adds 'char' ahead of 'text' until there are 'count' characters total /proc/add_leading(text, count, char = " ") diff --git a/code/modules/mob/typing_indicator.dm b/code/modules/mob/typing_indicator.dm index 4677498cc9c..197e472e920 100644 --- a/code/modules/mob/typing_indicator.dm +++ b/code/modules/mob/typing_indicator.dm @@ -41,7 +41,6 @@ set_typing_indicator(TRUE) var/message = tgui_input_text(usr, "Type your message:", "Say") - message = readd_quotes(message) set_typing_indicator(FALSE) if(message) @@ -53,7 +52,6 @@ set_typing_indicator(TRUE) var/message = tgui_input_text(usr, "Type your message:", "Emote", multiline = TRUE) - message = readd_quotes(message) set_typing_indicator(FALSE) if(message) @@ -65,7 +63,6 @@ set hidden = 1 var/message = tgui_input_text(usr, "Type your message:", "Whisper") - message = readd_quotes(message) if(message) whisper(message) @@ -75,7 +72,6 @@ set hidden = 1 var/message = tgui_input_text(usr, "Type your message:", "Subtle", multiline = TRUE) - message = readd_quotes(message) if(message) me_verb_subtle(message) diff --git a/code/modules/tgui_input/list.dm b/code/modules/tgui_input/list.dm index 76ebe411e40..fc0fdc9c1e4 100644 --- a/code/modules/tgui_input/list.dm +++ b/code/modules/tgui_input/list.dm @@ -9,8 +9,9 @@ * * items - The options that can be chosen by the user, each string is assigned a button on the UI. * * default - The option with this value will be selected on first paint of the TGUI window. * * timeout - The timeout of the input box, after which the input box will close and qdel itself. Set to zero for no timeout. + * * strict_modern - Disabled the preference check of the input box, only allowing the TGUI window to show. */ -/proc/tgui_input_list(mob/user, message, title = "Select", list/items, default, timeout = 0) +/proc/tgui_input_list(mob/user, message, title = "Select", list/items, default, timeout = 0, strict_modern = FALSE) if (istext(user)) stack_trace("tgui_alert() received text for user instead of mob") return @@ -25,7 +26,7 @@ else return /// Client does NOT have tgui_input on: Returns regular input - if(!usr.client.prefs.tgui_input_mode) + if(!usr.client.prefs.tgui_input_mode && !strict_modern) return input(user, message, title, default) as null|anything in items var/datum/tgui_list_input/input = new(user, message, title, items, default, timeout) input.tgui_interact(user) diff --git a/code/modules/tgui_input/text.dm b/code/modules/tgui_input/text.dm index 474f8e7c3e2..42c50d377a3 100644 --- a/code/modules/tgui_input/text.dm +++ b/code/modules/tgui_input/text.dm @@ -150,6 +150,7 @@ /datum/tgui_input_text/proc/set_entry(entry) if(!isnull(entry)) var/converted_entry = encode ? html_encode(entry) : entry + converted_entry = readd_quotes(converted_entry) src.entry = trim(converted_entry, max_length) /**