[apps/calculation] Move input memoization

Calculation's input is now only saved and restored when the app truly
closes or opens, instead of whenever the EditExpressionController enters
or leaves the responder chain (which also happens when the user switches
to the history or the toolbox, or triggers a syntax error).

Change-Id: I8404f1bc5619bcbc03272b406962d284fe25f7e2
This commit is contained in:
Gabriel Ozouf
2020-07-23 11:19:19 +02:00
committed by Émilie Feral
parent d027d99597
commit 9e3470436a
4 changed files with 20 additions and 5 deletions

View File

@@ -56,14 +56,16 @@ void EditExpressionController::insertTextBody(const char * text) {
void EditExpressionController::didBecomeFirstResponder() {
m_contentView.mainView()->scrollToBottom();
m_contentView.expressionField()->setEditing(true, false);
m_contentView.expressionField()->restoreContent(m_cacheBuffer, *m_cacheBufferInformation);
clearCacheBuffer();
Container::activeApp()->setFirstResponder(m_contentView.expressionField());
}
void EditExpressionController::willExitResponderChain(Responder * nextFirstResponder) {
void EditExpressionController::restoreInput() {
m_contentView.expressionField()->restoreContent(m_cacheBuffer, *m_cacheBufferInformation);
clearCacheBuffer();
}
void EditExpressionController::memoizeInput() {
*m_cacheBufferInformation = m_contentView.expressionField()->moveCursorAndDumpContent(m_cacheBuffer, k_cacheBufferSize);
::ViewController::willExitResponderChain(nextFirstResponder);
}
void EditExpressionController::viewWillAppear() {