X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fitem%2Finputbox.qc;h=d19125a218e658fd6c5cf4b45419abb6335906d1;hb=9e50112561ad6f4cefe6d13bd7185f5dfd1ada4b;hp=3272ed54f39ec1953ff8e61b822cced36287b414;hpb=31cefbf89224b89cec59dc8c54ea4cdc4c4b870b;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/item/inputbox.qc b/qcsrc/menu/item/inputbox.qc index 3272ed54f..d19125a21 100644 --- a/qcsrc/menu/item/inputbox.qc +++ b/qcsrc/menu/item/inputbox.qc @@ -106,19 +106,19 @@ void InputBox_enterText(entity me, string ch) { - float i; - for (i = 0; i < strlen(ch); ++i) + int len = strlen(ch); + for (int i = 0; i < len; ++i) if (strstrofs(me.forbiddenCharacters, substring(ch, i, 1), 0) > -1) return; if (me.maxLength > 0) { - if (strlen(ch) + strlen(me.text) > me.maxLength) return; + if (len + strlen(me.text) > me.maxLength) return; } else if (me.maxLength < 0) { if (u8_strsize(ch) + u8_strsize(me.text) > -me.maxLength) return; } me.setText(me, strcat(substring(me.text, 0, me.cursorPos), ch, substring(me.text, me.cursorPos, strlen(me.text) - me.cursorPos))); - me.cursorPos += strlen(ch); + me.cursorPos += len; } float InputBox_keyDown(entity me, float key, float ascii, float shift)