mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-25 16:50:50 +01:00
[poincare] Better removal of empty child in HorizontalLayout
Change-Id: I126af718ec8a983b22f07ab49fd3298b8b416ea5
This commit is contained in:
@@ -166,7 +166,7 @@ void HorizontalLayout::privateReplaceChild(const ExpressionLayout * oldChild, Ex
|
||||
|
||||
void HorizontalLayout::addOrMergeChildAtIndex(ExpressionLayout * eL, int index, bool removeEmptyChildren) {
|
||||
int newIndex = index;
|
||||
if (numberOfChildren() > 0 && child(0)->isEmpty()) {
|
||||
if (numberOfChildren() > 0 && child(0)->isEmpty() && (numberOfChildren() < 1 || !child(1)->mustHaveLeftBrother())) {
|
||||
removeChildAtIndex(0, true);
|
||||
newIndex = index == 0 ? 0 : index - 1;
|
||||
}
|
||||
@@ -371,12 +371,12 @@ void HorizontalLayout::privateAddBrother(ExpressionLayoutCursor * cursor, Expres
|
||||
return;
|
||||
}
|
||||
assert(cursor->position() == ExpressionLayoutCursor::Position::Right);
|
||||
// If the first child is empty, remove it before adding the layout.
|
||||
// If the last child is empty, remove it before adding the layout.
|
||||
int childrenCount = numberOfChildren();
|
||||
if (childrenCount > 0 && editableChild(childrenCount - 1)->isEmpty()) {
|
||||
removeChildAtIndex(childrenCount - 1, true);
|
||||
}
|
||||
addOrMergeChildAtIndex(brother, childrenCount, false);
|
||||
addOrMergeChildAtIndex(brother, numberOfChildren(), false);
|
||||
if (moveCursor) {
|
||||
cursor->setPointedExpressionLayout(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user