mirror of
https://github.com/Microsoft/calculator.git
synced 2025-07-14 01:02:52 -07:00
Fix bug when the negate sign is before a space (#345)
* Ignore None characters while parsing the clipboard * reformat
This commit is contained in:
parent
8e1a14793a
commit
9728ccf119
1 changed files with 64 additions and 61 deletions
|
@ -790,6 +790,12 @@ void StandardCalculatorViewModel::OnPaste(String^ pastedString, ViewMode mode)
|
||||||
|
|
||||||
NumbersAndOperatorsEnum mappedNumOp = MapCharacterToButtonId(*it, canSendNegate);
|
NumbersAndOperatorsEnum mappedNumOp = MapCharacterToButtonId(*it, canSendNegate);
|
||||||
|
|
||||||
|
if (mappedNumOp == NumbersAndOperatorsEnum::None)
|
||||||
|
{
|
||||||
|
++it;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (isFirstLegalChar || isPreviousOperator)
|
if (isFirstLegalChar || isPreviousOperator)
|
||||||
{
|
{
|
||||||
isFirstLegalChar = false;
|
isFirstLegalChar = false;
|
||||||
|
@ -811,8 +817,6 @@ void StandardCalculatorViewModel::OnPaste(String^ pastedString, ViewMode mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mappedNumOp != NumbersAndOperatorsEnum::None)
|
|
||||||
{
|
|
||||||
switch (mappedNumOp)
|
switch (mappedNumOp)
|
||||||
{
|
{
|
||||||
// Opening parenthesis starts a new expression and pushes negation state onto the stack
|
// Opening parenthesis starts a new expression and pushes negation state onto the stack
|
||||||
|
@ -881,7 +885,6 @@ void StandardCalculatorViewModel::OnPaste(String^ pastedString, ViewMode mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Handle exponent and exponent sign (...e+... or ...e-...)
|
// Handle exponent and exponent sign (...e+... or ...e-...)
|
||||||
if (mappedNumOp == NumbersAndOperatorsEnum::Exp)
|
if (mappedNumOp == NumbersAndOperatorsEnum::Exp)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue