From d27ed71518c605da627c4bcc1266f44ac86b8dde Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 29 Jul 2022 10:30:25 +0200 Subject: [PATCH] Increase maximum integer length to 12 characters This may cause overflows if the integer type is 32-bit, but we tend to use 64-bit anyway. And 9,999,999 was already an overflow too. Fixes #12859. --- resources/qml/Settings/SettingTextField.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Settings/SettingTextField.qml b/resources/qml/Settings/SettingTextField.qml index f0e3b2cacb..4e72bca93e 100644 --- a/resources/qml/Settings/SettingTextField.qml +++ b/resources/qml/Settings/SettingTextField.qml @@ -153,13 +153,13 @@ SettingItem selectionColor: UM.Theme.getColor("text_selection") selectByMouse: true - maximumLength: (definition.type == "str" || definition.type == "[int]") ? -1 : 10 + maximumLength: (definition.type == "str" || definition.type == "[int]") ? -1 : 12 // Since [int] & str don't have a max length, they need to be clipped (since clipping is expensive, this // should be done as little as possible) clip: definition.type == "str" || definition.type == "[int]" - validator: RegularExpressionValidator { regularExpression: (definition.type == "[int]") ? /^\[?(\s*-?[0-9]{0,9}\s*,)*(\s*-?[0-9]{0,9})\s*\]?$/ : (definition.type == "int") ? /^-?[0-9]{0,10}$/ : (definition.type == "float") ? /^-?[0-9]{0,9}[.,]?[0-9]{0,3}$/ : /^.*$/ } // definition.type property from parent loader used to disallow fractional number entry + validator: RegularExpressionValidator { regularExpression: (definition.type == "[int]") ? /^\[?(\s*-?[0-9]{0,11}\s*,)*(\s*-?[0-9]{0,11})\s*\]?$/ : (definition.type == "int") ? /^-?[0-9]{0,12}$/ : (definition.type == "float") ? /^-?[0-9]{0,11}[.,]?[0-9]{0,3}$/ : /^.*$/ } // definition.type property from parent loader used to disallow fractional number entry Binding {