Fixed issue #261 of 0√

Cause : lastKey was not updated when newValue became "". Hence lastKey validation at line 95 failed.
This commit is contained in:
rsb-23 2022-07-04 00:17:08 +05:30
parent 983b645ce3
commit 9e6e3b4057

View file

@ -324,8 +324,9 @@ class CalculatorImpl(
val lastDeletedValue = inputDisplayedFormula.lastOrNull().toString()
var newValue = inputDisplayedFormula.dropLast(1)
if (newValue == "") {
if (newValue == "" || newValue == "0") {
newValue = "0"
lastKey = CLEAR
} else {
if (operations.contains(lastDeletedValue) || lastKey == EQUALS) {
lastOperation = ""