Skip to content

Commit 3ae709f

Browse files
committed
try this
1 parent 2f58e9e commit 3ae709f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

inputMethods.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,10 @@ namespace microgui {
277277
const len = txt.length;
278278
const lenRule = txt[len - 1] != "-";
279279
const noDecimalEnding = txt[len - 1] != "."; // Illegal: 0. , -0. , -10. Okay: -0.00.. and 0.000 (becomes 0 later)
280+
const noZeroPosInt = txt === "0"
280281

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.
282284
// Turn -0 and -0.000... into 0 before returning
283285
const txtAsNum: number = +txt;
284286
if (txtAsNum == 0 || txtAsNum == -0)

0 commit comments

Comments
 (0)