mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 07:38:05 +01:00
Unicode awareness Part 2 -- copytext() (#48512)
* Unicode support Part 2 -- copytext() This is the transition of all copytext() calls to be unicode aware and also some nearby calls in the same functions. Most things are just replacing copytext() with copytext_char() as a terrible character limiter but a few others were slightly more involved. I replaced a ton of ```` var/something = sanitize(input()) something = copytext(something, 1, MAX_MESSAGE_LEN) ```` with a single stripped_input() call. stripped_input() already calls html_encode(), trim(), and some other sanitization so there shouldn't be any major issues there. This is still VERY rough btw; DNA is a mess, the status displays are complete ass, there's a copytext() in code\datums\shuttles.dm that I'm not sure what to do with, and I didn't touch anything in the tools folder. I haven't tested this much at all yet, I only got it to compile earlier this morning. There's also likely to be weird bugs until I get around to fixing length(), findtext(), and the rest of the string procs. * Makes the code functional * Assume color hex strings are always # followed by ascii. Properly encodes and decodes the stuff in mob_helpers.dm which fixes some issues there. * Removes ninjaspeak since it's unused
This commit is contained in:
@@ -45,15 +45,13 @@
|
||||
to_chat(user, "<span class='notice'>You scribble illegibly on the cover of [src]!</span>")
|
||||
return
|
||||
|
||||
var/inputvalue = input(user, "What would you like to label the folder?", "Folder Labelling", null) as text|null
|
||||
|
||||
if (isnull(inputvalue))
|
||||
var/inputvalue = stripped_input(user, "What would you like to label the folder?", "Folder Labelling", "", MAX_NAME_LEN)
|
||||
|
||||
if(!inputvalue)
|
||||
return
|
||||
|
||||
var/n_name = copytext(sanitize(inputvalue), 1, MAX_NAME_LEN)
|
||||
|
||||
|
||||
if(user.canUseTopic(src, BE_CLOSE))
|
||||
name = "folder[(n_name ? " - '[n_name]'" : null)]"
|
||||
name = "folder[(inputvalue ? " - '[inputvalue]'" : null)]"
|
||||
|
||||
|
||||
/obj/item/folder/attack_self(mob/user)
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
if(mode)
|
||||
to_chat(user, "<span class='notice'>You turn on [src].</span>")
|
||||
//Now let them chose the text.
|
||||
var/str = copytext(reject_bad_text(input(user,"Label text?","Set label","")),1,MAX_NAME_LEN)
|
||||
var/str = reject_bad_text(stripped_input(user, "Label text?", "Set label","", MAX_NAME_LEN))
|
||||
if(!str || !length(str))
|
||||
to_chat(user, "<span class='warning'>Invalid text!</span>")
|
||||
return
|
||||
|
||||
@@ -148,7 +148,10 @@
|
||||
if(istart == 0)
|
||||
return //No field found with matching id
|
||||
|
||||
laststart = istart+1
|
||||
if(links)
|
||||
laststart = istart + length(info_links[istart])
|
||||
else
|
||||
laststart = istart + length(info[istart])
|
||||
locid++
|
||||
if(locid == id)
|
||||
var/iend = 1
|
||||
|
||||
Reference in New Issue
Block a user