diff --git a/src/AppMain.c b/src/AppMain.c index 0ebfeee..dac5e5e 100644 --- a/src/AppMain.c +++ b/src/AppMain.c @@ -960,24 +960,29 @@ static void AppendQuantityDigit(UInt16 digit) { Char digitText[2]; - if (StrLen(gQuantity) > 2) { - // If the current quantity already exceeds 2 digits, issue a warning - // beep instead of appending the digit. + if (! gQuantityTouched) { + // This is the first time the quantity is being touched; replace it + // outright instead of appending the digit. + StrIToA(gQuantity, digit); + UpdateQuantityDisplay(); + gQuantityTouched = true; + + } else if (StrLen(gQuantity) > 2) { + // The current quantity already exceeds 2 digits; issue a warning beep + // instead of appending the digit. SndPlaySystemSound(sndWarning); - } else if (gQuantityTouched && StrCompare(gQuantity, "0") != 0) { + } else if (StrCompare(gQuantity, "0") == 0) { + // The current quantity is zero; replace it outright instead of + // appending the digit. + StrIToA(gQuantity, digit); + UpdateQuantityDisplay(); + + } else { // Okay, we can append the digit. StrIToA(digitText, digit); StrCat(gQuantity, digitText); UpdateQuantityDisplay(); - - } else { - // Either this is the first time the quantity is being touched, or else - // the quantity is currently zero. Replace it outright instead of - // appending the digit. - StrIToA(gQuantity, digit); - UpdateQuantityDisplay(); - gQuantityTouched = true; } }