[apps/code] Put cursor inside parentheses when inserting function

In Code::VariableBoxController.

Change-Id: Ib129781d46159c017bcb02e97c6667b6084f5b67
This commit is contained in:
Léa Saviot
2018-05-16 11:44:48 +02:00
committed by EmilieNumworks
parent 291958a901
commit 99f6d73e19
4 changed files with 7 additions and 2 deletions

View File

@@ -87,7 +87,7 @@ bool VariableBoxController::ContentViewController::handleEvent(Ion::Events::Even
ScriptNode selectedScriptNode = m_scriptNodes[m_selectableTableView.selectedRow()];
insertTextInCaller(selectedScriptNode.name());
if (selectedScriptNode.type() == ScriptNode::Type::Function) {
insertTextInCaller(ScriptNodeCell::k_parentheses);
insertTextInCaller(ScriptNodeCell::k_parenthesesWithEmpty);
}
m_selectableTableView.deselectTable();
app()->dismissModalViewController();
@@ -117,7 +117,7 @@ void VariableBoxController::ContentViewController::willDisplayCellForIndex(Highl
void VariableBoxController::ContentViewController::insertTextInCaller(const char * text) {
int commandBufferMaxSize = strlen(text)+1;
char commandBuffer[commandBufferMaxSize];
Shared::ToolboxHelpers::TextToInsertForCommandText(text, commandBuffer, commandBufferMaxSize);
Shared::ToolboxHelpers::TextToInsertForCommandText(text, commandBuffer, commandBufferMaxSize, true);
m_textInputCaller->handleEventWithText(commandBuffer);
}