From 03471bb7b4e51391536b80da472938ec30972c15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Fri, 10 Apr 2020 17:16:12 +0200 Subject: [PATCH] [apps/code] Insert right text form var box The text was iffset due to the subtitle rows --- apps/code/variable_box_controller.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/code/variable_box_controller.cpp b/apps/code/variable_box_controller.cpp index 3a1563a34..196a4f7e9 100644 --- a/apps/code/variable_box_controller.cpp +++ b/apps/code/variable_box_controller.cpp @@ -316,7 +316,12 @@ int VariableBoxController::typeAndOriginAtLocation(int i, NodeOrigin * resultOri bool VariableBoxController::selectLeaf(int rowIndex) { assert(rowIndex >= 0 && rowIndex < numberOfRows()); m_selectableTableView.deselectTable(); - ScriptNode * selectedScriptNode = scriptNodeAtIndex(rowIndex); + + int cumulatedOriginsCount = 0; + int cellType = typeAndOriginAtLocation(rowIndex, nullptr, &cumulatedOriginsCount); + assert(cellType == k_itemCellType); + (void)cellType; // Silence warnings + ScriptNode * selectedScriptNode = scriptNodeAtIndex(rowIndex - cumulatedOriginsCount); // Remove the number of subtitle cells from the index insertTextInCaller(selectedScriptNode->name() + m_shortenResultCharCount, selectedScriptNode->nameLength() - m_shortenResultCharCount); if (selectedScriptNode->type() == ScriptNode::Type::Function) { insertTextInCaller(ScriptNodeCell::k_parenthesesWithEmpty);