diff --git a/poincare/src/layout/matrix_layout.cpp b/poincare/src/layout/matrix_layout.cpp index afccc9260..7626efa06 100644 --- a/poincare/src/layout/matrix_layout.cpp +++ b/poincare/src/layout/matrix_layout.cpp @@ -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) { diff --git a/poincare/src/layout/matrix_layout.h b/poincare/src/layout/matrix_layout.h index 6a58bb0cd..30dccb142 100644 --- a/poincare/src/layout/matrix_layout.h +++ b/poincare/src/layout/matrix_layout.h @@ -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;