mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 05:00:55 +01:00
[MIRROR] Fixes paper text length not counting correctly for cyrillic characters [MDB IGNORE] (#20840)
* Fixes paper text length not counting correctly for cyrillic characters (#75021) ## About The Pull Request It turns out someone used regular length() in papers code which caused all cyrillic and some other characters to count as two symbols even though tgui itself shows and counts them as one. Should be working fine now. ## Why It's Good For The Game less bugs = better game ## Changelog 🆑 fix: papers should count cyrillic and other non-ascii characters correctly both server and client-side /🆑 * Fixes paper text length not counting correctly for cyrillic characters --------- Co-authored-by: Iajret <8430839+Iajret@users.noreply.github.com>
This commit is contained in:
@@ -549,7 +549,7 @@
|
||||
return TRUE
|
||||
if("add_text")
|
||||
var/paper_input = params["text"]
|
||||
var/this_input_length = length(paper_input)
|
||||
var/this_input_length = length_char(paper_input)
|
||||
|
||||
if(this_input_length == 0)
|
||||
to_chat(user, pick("Writing block strikes again!", "You forgot to write anthing!"))
|
||||
@@ -621,7 +621,7 @@
|
||||
|
||||
for(var/field_key in field_data)
|
||||
var/field_text = field_data[field_key]
|
||||
var/text_length = length(field_text)
|
||||
var/text_length = length_char(field_text)
|
||||
if(text_length > MAX_PAPER_INPUT_FIELD_LENGTH)
|
||||
log_paper("[key_name(user)] tried to write to field [field_key] with text over the max limit ([text_length] out of [MAX_PAPER_INPUT_FIELD_LENGTH]) with the following text: [field_text]")
|
||||
return TRUE
|
||||
@@ -652,7 +652,7 @@
|
||||
/obj/item/paper/proc/get_total_length()
|
||||
var/total_length = 0
|
||||
for(var/datum/paper_input/entry as anything in raw_text_inputs)
|
||||
total_length += length(entry.raw_text)
|
||||
total_length += length_char(entry.raw_text)
|
||||
|
||||
return total_length
|
||||
|
||||
|
||||
Reference in New Issue
Block a user