Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Fixes tgui text input trimming the last char if the input hits the max length #2315

Merged
merged 3 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions code/__DEFINES/text.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
/// Removes everything enclose in < and > inclusive of the bracket, and limits the length of the message.
#define STRIP_HTML_FULL(text, limit) (GLOB.html_tags.Replace(copytext(text, 1, limit), ""))

/**
* stuff like `copytext(input, length(input))` will trim the last character of the input,
* because DM does it so it copies until the char BEFORE the `end` arg, so we need to bump `end` by 1 in these cases.
*/
#define PREVENT_CHARACTER_TRIM_LOSS(integer) (integer + 1)

/// Folder directory for strings
#define STRING_DIRECTORY "strings"

Expand Down
12 changes: 12 additions & 0 deletions code/game/objects/items/food/sweets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@
venue_value = FOOD_PRICE_WORTHLESS
var/mutable_appearance/head
var/head_color = rgb(0, 0, 0)
/// NOVA EDIT ADDITION BEGIN
//Copies reagent metabolization from bubblegum so that you cant get infinite reagents from wearing lolipops
var/metabolization_amount = REAGENTS_METABOLISM / 2
// NOVA EDIT ADDITION END

/// NOVA ADDITION BEGIN
//Copies regent metabolization from bubblegum so that you cant get infinite reagents from wearing lolipops
Expand Down Expand Up @@ -357,6 +361,10 @@
food_flags = FOOD_FINGER_FOOD
slot_flags = ITEM_SLOT_MASK
crafting_complexity = FOOD_COMPLEXITY_1
// NOVA EDIT ADDITION BEGIN
//Copies reagent metabolization from bubblegum so that you cant get infinite reagents from wearing lolipops
var/metabolization_amount = REAGENTS_METABOLISM / 2
// NOVA EDIT ADDITION END

/// NOVA ADDITION BEGIN
//Copies regent metabolization from bubblegum so that you cant get infinite reagents from wearing lolipops
Expand Down Expand Up @@ -385,6 +393,10 @@
food_flags = FOOD_FINGER_FOOD
slot_flags = ITEM_SLOT_MASK
crafting_complexity = FOOD_COMPLEXITY_1
/// NOVA EDIT ADDITION BEGIN
//Copies reagent metabolization from bubblegum so that you cant get infinite reagents from wearing lolipops
var/metabolization_amount = REAGENTS_METABOLISM / 2
// NOVA EDIT ADDITION END

/// NOVA ADDITION BEGIN
//Copies regent metabolization from bubblegum so that you cant get infinite reagents from wearing lolipops
Expand Down
6 changes: 3 additions & 3 deletions code/modules/tgui_input/text.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
if(!user.client.prefs.read_preference(/datum/preference/toggle/tgui_input))
if(encode)
if(multiline)
return stripped_multiline_input(user, message, title, default, max_length)
return stripped_multiline_input(user, message, title, default, PREVENT_CHARACTER_TRIM_LOSS(max_length))
else
return stripped_input(user, message, title, default, max_length)
return stripped_input(user, message, title, default, PREVENT_CHARACTER_TRIM_LOSS(max_length))
else
if(multiline)
return input(user, message, title, default) as message|null
Expand Down Expand Up @@ -162,4 +162,4 @@
/datum/tgui_input_text/proc/set_entry(entry)
if(!isnull(entry))
var/converted_entry = encode ? html_encode(entry) : entry
src.entry = trim(converted_entry, max_length)
src.entry = trim(converted_entry, PREVENT_CHARACTER_TRIM_LOSS(max_length))
Loading