From 51d88273190d347c3948a94729a2f710cef5acb7 Mon Sep 17 00:00:00 2001 From: erysdren Date: Sun, 17 Nov 2024 10:57:20 -0600 Subject: [PATCH] MENU: m_menu.qc: cap maxlen at 23 --- source/menu/m_menu.qc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/source/menu/m_menu.qc b/source/menu/m_menu.qc index e070487..4c013cd 100644 --- a/source/menu/m_menu.qc +++ b/source/menu/m_menu.qc @@ -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 = { - float maxlen = 0; - - if (getTextWidth(text, MENU_TEXT_SMALL.x) + 18 >= size.x) - maxlen = strlen(text); - else - maxlen = 128; + // best length to fit the largest character in the font + // ex: AAAAAAAAAAAAAAAAAAAAAAA + float maxlen = 23; sui_action_element(pos, size, id, sui_noop); if (sui_is_clicked(id)) cursor = strlen(text);