MENU: m_menu.qc: cap maxlen at 23

This commit is contained in:
erysdren 2024-11-17 10:57:20 -06:00
parent 854530bf8a
commit 51d8827319

View file

@ -554,12 +554,9 @@ void(float order, vector minmaxsteps, string cvar_s, float is_int, float no_text
static void(string id, vector pos, vector size, __inout string text, __inout float cursor) handle_text_input = static void(string id, vector pos, vector size, __inout string text, __inout float cursor) handle_text_input =
{ {
float maxlen = 0; // best length to fit the largest character in the font
// ex: AAAAAAAAAAAAAAAAAAAAAAA
if (getTextWidth(text, MENU_TEXT_SMALL.x) + 18 >= size.x) float maxlen = 23;
maxlen = strlen(text);
else
maxlen = 128;
sui_action_element(pos, size, id, sui_noop); sui_action_element(pos, size, id, sui_noop);
if (sui_is_clicked(id)) cursor = strlen(text); if (sui_is_clicked(id)) cursor = strlen(text);