[apps/math_toolbox] Handle const char * when selecting a leaf.

Else, there would be a problem with sequence_toolbox, where not all
toolbox leaves are message trees.

Change-Id: Ib4968aad37f6a835b1ea4d77efac2ae1bd19c7ce
This commit is contained in:
Léa Saviot
2018-01-19 16:24:05 +01:00
parent 2cb8956665
commit f3e6b10410
6 changed files with 31 additions and 30 deletions

View File

@@ -128,13 +128,13 @@ void VariableBoxController::ContentViewController::insertTextInCaller(const char
}
int previousCursorLocation = m_textFieldCaller->cursorLocation();
m_textFieldCaller->insertTextAtLocation(commandBuffer, previousCursorLocation);
m_textFieldCaller->setCursorLocation(previousCursorLocation + Shared::ToolboxHelpers::CursorIndexInCommand(commandBuffer));
m_textFieldCaller->setCursorLocation(previousCursorLocation + Shared::ToolboxHelpers::CursorIndexInCommandText(commandBuffer));
return;
}
if (m_textAreaCaller != nullptr) {
int previousCursorLocation = m_textAreaCaller->cursorLocation();
m_textAreaCaller->insertText(commandBuffer);
int deltaCursorLocation = - m_textAreaCaller->cursorLocation() + previousCursorLocation + Shared::ToolboxHelpers::CursorIndexInCommand(commandBuffer);
int deltaCursorLocation = - m_textAreaCaller->cursorLocation() + previousCursorLocation + Shared::ToolboxHelpers::CursorIndexInCommandText(commandBuffer);
m_textAreaCaller->moveCursor(deltaCursorLocation);
}
}