[poincare] Fix empty layout that stayed

When typing 1|23 then pressing / and poing up.

Change-Id: I15752919914af526b35483b2abf2a027cddc4e7b
This commit is contained in:
Léa Saviot
2018-04-16 17:41:56 +02:00
parent 9b22175877
commit 1342c0f2db
2 changed files with 3 additions and 3 deletions

View File

@@ -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;

View File

@@ -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);
}