[516] Fix TGUI input text max_length (#90039)

## About The Pull Request
Fixes default max_lenght on TGUI input text.
Chromium ignores symbols in maxlength attribute, so instead of infinity
it was... 1.

Without setting attribute, it was literally infinite (close enough)

![image](https://github.com/user-attachments/assets/7a6c643c-c43c-4bad-bd26-b8b22145a3d9)

Closes #89331

## Why It's Good For The Game


![image](https://github.com/user-attachments/assets/8421f8af-5bf7-45bf-bd2e-1d54e3f98c6d)

## Changelog

🆑
fix: Fixed TGUI text inputs, that's allows only 1 symbol instead
infinity
/🆑
This commit is contained in:
Aylong
2025-03-16 01:53:46 -04:00
committed by nevimer
parent e9c1c98170
commit de62e75433
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -10,12 +10,12 @@
* * message - The content of the text input, shown in the body of the TGUI window.
* * title - The title of the text input modal, shown on the top of the TGUI window.
* * default - The default (or current) value, shown as a placeholder.
* * max_length - Specifies a max length for input. MAX_MESSAGE_LEN is default (1024)
* * max_length - Specifies a max length for input. By default is infinity.
* * multiline - Bool that determines if the input box is much larger. Good for large messages, laws, etc.
* * encode - Toggling this determines if input is filtered via html_encode. Setting this to FALSE gives raw input.
* * timeout - The timeout of the textbox, after which the modal will close and qdel itself. Set to zero for no timeout.
*/
/proc/tgui_input_text(mob/user, message = "", title = "Text Input", default, max_length = INFINITY, multiline = FALSE, encode = TRUE, timeout = 0, ui_state = GLOB.always_state)
/proc/tgui_input_text(mob/user, message = "", title = "Text Input", default, max_length, multiline = FALSE, encode = TRUE, timeout = 0, ui_state = GLOB.always_state)
if (!user)
user = usr
if (!istype(user))
@@ -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, PREVENT_CHARACTER_TRIM_LOSS(max_length))
src.entry = max_length ? trim(converted_entry, PREVENT_CHARACTER_TRIM_LOSS(max_length)) : converted_entry