From 1342c0f2db371eaca7520287c37cc6677981a256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Mon, 16 Apr 2018 17:41:56 +0200 Subject: [PATCH] [poincare] Fix empty layout that stayed When typing 1|23 then pressing / and poing up. Change-Id: I15752919914af526b35483b2abf2a027cddc4e7b --- poincare/src/expression_layout_cursor.cpp | 2 +- poincare/src/layout/horizontal_layout.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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); }