Skip to content

Commit

Permalink
feat: return text to user on failed sanitize
Browse files Browse the repository at this point in the history
Print user input back to their chat in case sanitization failed.
Solves an annoying issue with users losing their long input text if it
hits the message length limit, as there was no way to know about the
limit ahead of time and no way to get the text back.
  • Loading branch information
rufuszero committed Oct 19, 2024
1 parent 1f354b2 commit d48a0e3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion code/_helpers/text.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
if(max_length)
var/input_length = length_char(input)
if(input_length > max_length)
to_chat(usr, SPAN_WARNING("Your message is too long by [input_length - max_length] character\s."))
to_chat(usr, SPAN_WARNING("Your message is too long by [input_length - max_length] character\s.\nHere's your text for easy copying:\n[input]"))
return
input = copytext_char(input, 1, max_length+1)

Expand Down

0 comments on commit d48a0e3

Please sign in to comment.