[poincare] Fix empty layout insertion in horizontal layout

This commit is contained in:
Léa Saviot
2018-09-14 17:19:51 +02:00
parent d1e9c460ca
commit d34ee9ceee

View File

@@ -388,7 +388,12 @@ void HorizontalLayoutReference::addOrMergeChildAtIndex(LayoutReference l, int in
}
void HorizontalLayoutReference::addChildAtIndex(LayoutReference l, int index, int currentNumberOfChildren, LayoutCursor * cursor, bool removeEmptyChildren) {
if (!removeEmptyChildren || !l.isEmpty()) {
if (!removeEmptyChildren
|| !l.isEmpty()
|| numberOfChildren() == 0
|| (index < numberOfChildren()
&& childAtIndex(index).mustHaveLeftSibling()))
{
LayoutReference::addChildAtIndex(l, index, currentNumberOfChildren, cursor);
}
}