1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:47:37 +00:00

Calculator: Support chaining and repeating operations

The calculator now supports chaining (hitting "1+2+3=" shows "6"
instead of "5") and repeating ("2+2===" shows "8") operations. :^)
This commit is contained in:
Karol Baraniecki 2022-12-26 17:12:46 +01:00 committed by Andreas Kling
parent ef9fd6c286
commit 21cc8f65f5
5 changed files with 126 additions and 72 deletions

View file

@ -135,6 +135,11 @@ DeprecatedString Keypad::to_deprecated_string() const
return builder.to_deprecated_string();
}
bool Keypad::in_typing_state() const
{
return m_state == State::TypingDecimal || m_state == State::TypingInteger;
}
void Keypad::set_rounding_length(unsigned rounding_threshold)
{
m_displayed_fraction_length = rounding_threshold;