[poincare] Fixed deletion bug in MatrixLayout.

Change-Id: I0dbc142468320fac4ed8969a3ef2684549315780
This commit is contained in:
Léa Saviot
2018-01-11 14:27:20 +01:00
parent bf4ccd76ea
commit e2bd7ddbe0
2 changed files with 7 additions and 0 deletions

View File

@@ -117,6 +117,12 @@ void MatrixLayout::replaceChildAndMoveCursor(const ExpressionLayout * oldChild,
cursor->setPosition(ExpressionLayoutCursor::Position::Left);
}
void MatrixLayout::removePointedChildAtIndexAndMoveCursor(int index, bool deleteAfterRemoval, ExpressionLayoutCursor * cursor) {
assert(index >= 0 && index < numberOfChildren());
assert(cursor->pointedExpressionLayout() == child(index));
replaceChildAndMoveCursor(child(index), new EmptyVisibleLayout(), deleteAfterRemoval, cursor);
}
int MatrixLayout::writeTextInBuffer(char * buffer, int bufferSize) const {
// The grid is a matrix.
if (bufferSize == 0) {

View File

@@ -19,6 +19,7 @@ public:
/* Dynamic layout */
void replaceChild(const ExpressionLayout * oldChild, ExpressionLayout * newChild, bool deleteOldChild = true) override;
void replaceChildAndMoveCursor(const ExpressionLayout * oldChild, ExpressionLayout * newChild, bool deleteOldChild, ExpressionLayoutCursor * cursor) override;
void removePointedChildAtIndexAndMoveCursor(int index, bool deleteAfterRemoval, ExpressionLayoutCursor * cursor) override;
/* Expression engine */
int writeTextInBuffer(char * buffer, int bufferSize) const override;