Handle "Subtract" ( "-" ) Operation as "Toggle Sign" ( "+/-" ) in Special Cases to fix #1541 and #1311 #2035
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1541
Fixes #1311
This Pull request addresses these following issues:
Typing the most negative number by numpad not possible #1541
Entering negative exponents in Scientific mode is not supported #1311
by Handling "Subtract" ("-") Binary operator as "Toggle Sign" ("+/-") in Special cases.
Description of the changes:
IsGuiSettingOpCode
method insidesrc/CalcManager/CEngine/CalcUtils.cpp
to saveIDC_EXP
inCCalcEngine::m_nLastCom
to check if next input isIDC_SUB
(Subtract Operation) and alsom_nLastCom
isIDC_EXP
so we can redirect this operation intoIDC_SIGN
(+/-) operation.CCalcEngine:m_bFlagSign
to store, subtracting with zero as a "Toggle Sign" Operation (IDC_SIGN
), so that the following digit inputs (the second operand) will be of negative sign, following is the piece of code from the pull request where the same is done.How changes were validated:
Output for #1541
Recording.2023-08-06.203946.mp4
Output for #1311
Recording.2023-08-06.203512.mp4