diff --git a/apps/calculation/edit_expression_controller.cpp b/apps/calculation/edit_expression_controller.cpp index c3476d3ca..43e37501d 100644 --- a/apps/calculation/edit_expression_controller.cpp +++ b/apps/calculation/edit_expression_controller.cpp @@ -61,8 +61,7 @@ const char * EditExpressionController::textBody() { void EditExpressionController::insertTextBody(const char * text) { TextField * tf = ((ContentView *)view())->textField(); tf->setEditing(true, false); - tf->insertTextAtLocation(text, tf->cursorLocation()); - tf->setCursorLocation(tf->cursorLocation() + strlen(text)); + tf->handleEventWithText(text); } bool EditExpressionController::handleEvent(Ion::Events::Event event) { diff --git a/apps/calculation/text_field.cpp b/apps/calculation/text_field.cpp index e9349c201..4e7d9c032 100644 --- a/apps/calculation/text_field.cpp +++ b/apps/calculation/text_field.cpp @@ -13,9 +13,7 @@ bool TextField::handleEvent(Ion::Events::Event event) { return false; } if (event == Ion::Events::Ans) { - insertTextAtLocation("ans", cursorLocation()); - setCursorLocation(cursorLocation() + strlen("ans")); - return true; + return handleEventWithText("ans"); } if (isEditing() && draftTextLength() == 0 && (event == Ion::Events::Multiplication || @@ -24,8 +22,7 @@ bool TextField::handleEvent(Ion::Events::Event event) { event == Ion::Events::Square || event == Ion::Events::Division || event == Ion::Events::Sto)) { - insertTextAtLocation("ans", cursorLocation()); - setCursorLocation(cursorLocation() + strlen("ans")); + handleEventWithText("ans"); } return(::TextField::handleEvent(event)); } diff --git a/apps/code/app.cpp b/apps/code/app.cpp index dcbd81afa..d7c99c0c1 100644 --- a/apps/code/app.cpp +++ b/apps/code/app.cpp @@ -1,7 +1,6 @@ #include "app.h" #include "../apps_container.h" #include "code_icon.h" -#include "../shared/toolbox_helpers.h" #include "../i18n.h" namespace Code { @@ -80,27 +79,12 @@ App::App(Container * container, Snapshot * snapshot) : m_codeStackViewController(&m_modalViewController, &m_listFooter), m_toolboxActionForTextArea([](void * sender, const char * text) { TextArea * textArea = static_cast