diff --git a/poincare/src/expression_layout_cursor.cpp b/poincare/src/expression_layout_cursor.cpp index 748c8425c..18ae81332 100644 --- a/poincare/src/expression_layout_cursor.cpp +++ b/poincare/src/expression_layout_cursor.cpp @@ -85,7 +85,7 @@ void ExpressionLayoutCursor::addFractionLayoutAndCollapseBrothers() { rightBrother = newChild->editableParent()->editableChild(fractionIndexInParent+1); if (rightBrother->isCollapsable(&numberOfOpenParenthesis, false)) { newChild->editableParent()->removeChildAtIndex(fractionIndexInParent+1, false); - child2->addOrMergeChildAtIndex(rightBrother, child2->numberOfChildren(), false); + child2->addOrMergeChildAtIndex(rightBrother, child2->numberOfChildren(), true); numberOfBrothers--; } else { break; diff --git a/poincare/src/layout/horizontal_layout.cpp b/poincare/src/layout/horizontal_layout.cpp index af9875390..43a7fae89 100644 --- a/poincare/src/layout/horizontal_layout.cpp +++ b/poincare/src/layout/horizontal_layout.cpp @@ -278,12 +278,12 @@ bool HorizontalLayout::moveDown(ExpressionLayoutCursor * cursor, bool * shouldRe } void HorizontalLayout::addChildrenAtIndex(const ExpressionLayout * const * operands, int numberOfOperands, int indexForInsertion, bool removeEmptyChildren) { - int newIndex = removeEmptyChildBeforeInsertionAtIndex(indexForInsertion, operands[0]->mustHaveLeftBrother()); + int newIndex = removeEmptyChildBeforeInsertionAtIndex(indexForInsertion, !operands[0]->mustHaveLeftBrother()); DynamicLayoutHierarchy::addChildrenAtIndex(operands, numberOfOperands, newIndex, removeEmptyChildren); } bool HorizontalLayout::addChildAtIndex(ExpressionLayout * operand, int index) { - int newIndex = removeEmptyChildBeforeInsertionAtIndex(index, operand->mustHaveLeftBrother()); + int newIndex = removeEmptyChildBeforeInsertionAtIndex(index, !operand->mustHaveLeftBrother()); return DynamicLayoutHierarchy::addChildAtIndex(operand, newIndex); }