We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2f58e9e commit 3ae709fCopy full SHA for 3ae709f
1 file changed
inputMethods.ts
@@ -277,8 +277,10 @@ namespace microgui {
277
const len = txt.length;
278
const lenRule = txt[len - 1] != "-";
279
const noDecimalEnding = txt[len - 1] != "."; // Illegal: 0. , -0. , -10. Okay: -0.00.. and 0.000 (becomes 0 later)
280
+ const noZeroPosInt = txt === "0"
281
- if (len > 0 && lenRule && noDecimalEnding) { // Last rule could be removed, casting "1." to number is valid.
282
+ if (len > 0 && (layout == KeyboardLayouts.NUMERIC && lenRule && noDecimalEnding ||
283
+ layout == KeyboardLayouts.NUMERIC_POSITIVE_INTEGER && noZeroPosInt)) { // Last rule could be removed, casting "1." to number is valid.
284
// Turn -0 and -0.000... into 0 before returning
285
const txtAsNum: number = +txt;
286
if (txtAsNum == 0 || txtAsNum == -0)
0 commit comments