diff --git a/apps/graph/values/values_parameter_controller.cpp b/apps/graph/values/values_parameter_controller.cpp index 3518ca1be..ee105ffe2 100644 --- a/apps/graph/values/values_parameter_controller.cpp +++ b/apps/graph/values/values_parameter_controller.cpp @@ -110,18 +110,28 @@ bool ValuesParameterController::handleEvent(Ion::Events::Event event) { setActiveCell(m_activeCell-1); return true; case Ion::Events::Event::ENTER: - editParameterInterval(); + editInterval(false); return true; default: - return false; + if ((int)event >= 0x100) { + return false; + } + editInterval(true, (char)event); + return true; } } -void ValuesParameterController::editParameterInterval() { +void ValuesParameterController::editInterval(bool overwrite, char initialDigit) { /* This code assumes that the active cell remains the one which is edited * until the invocation is performed. This could lead to concurrency issue in * other cases. */ - const char * initialTextContent = ListViewCellAtIndex(m_activeCell)->textContent(); + char initialTextContent[16]; + if (overwrite) { + initialTextContent[0] = initialDigit; + initialTextContent[1] = 0; + } else { + strlcpy(initialTextContent, ListViewCellAtIndex(m_activeCell)->textContent(), sizeof(initialTextContent)); + } App * myApp = (App *)app(); InputViewController * inputController = myApp->inputViewController(); inputController->edit(this, initialTextContent, this, diff --git a/apps/graph/values/values_parameter_controller.h b/apps/graph/values/values_parameter_controller.h index 56df38c75..69939a1f5 100644 --- a/apps/graph/values/values_parameter_controller.h +++ b/apps/graph/values/values_parameter_controller.h @@ -11,7 +11,7 @@ public: Interval * interval(); TextListViewCell * ListViewCellAtIndex(int index); int activeCell(); - void editParameterInterval(); + void editInterval(bool overwrite, char initialDigit = 0); void setIntervalParameterAtIndex(int parameterIndex, float f); View * view() override;