[poincare] BracketPairLayoutNode and BracketLayoutNode

This commit is contained in:
Léa Saviot
2018-08-10 11:11:03 +02:00
parent e2a3993f88
commit e6f77c4382
2 changed files with 4 additions and 2 deletions

View File

@@ -5,6 +5,8 @@ SFLAGS += -Ipoincare/include
objs += $(addprefix poincare/src/,\
absolute_value_layout_node.o\
binomial_coefficient_layout_node.o\
bracket_layout_node.o\
bracket_pair_layout_node.o\
addition.o\
arithmetic.o\
expression_lexer.o\

View File

@@ -76,14 +76,14 @@ void BracketPairLayoutNode::deleteBeforeCursor(LayoutCursor * cursor) {
LayoutRef rootRef = LayoutRef(root());
LayoutRef thisRef = LayoutRef(this);
LayoutRef child = childLayout();
replaceChildWithGhostInPlace(child);
thisRef.replaceChildWithGhostInPlace(child);
// WARNING: do not call "this" afterwards
if (rootRef.isAllocationFailure()) {
cursor->setLayoutReference(rootRef);
return;
}
cursor->setLayoutReference(thisRef.childAtIndex(0));
cursor->setPosition(LayoutNode::Position::Left);
cursor->setPosition(LayoutCursor::Position::Left);
thisRef.replaceWith(child, cursor);
return;
}