mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-27 01:29:58 +01:00
[poincare] Fix layout insertion
This commit is contained in:
@@ -243,14 +243,15 @@ void LayoutField::insertLayoutAtCursor(LayoutRef layoutR, LayoutRef pointedLayou
|
||||
LayoutRef lastMergedLayoutChild = layoutWillBeMerged ? layoutR.childAtIndex(layoutR.numberOfChildren()-1) : LayoutRef(nullptr);
|
||||
m_contentView.cursor()->addLayoutAndMoveCursor(layoutR);
|
||||
if (!forceCursorRightOfLayout) {
|
||||
if (pointedLayoutR.isDefined() && (!layoutWillBeMerged || pointedLayoutR != layoutR)) {
|
||||
if (pointedLayoutR.isDefined() && pointedLayoutR.parent().isDefined() && (!layoutWillBeMerged || pointedLayoutR != layoutR)) {
|
||||
// Make sure the layout was inserted (its parent is not nullptr)
|
||||
m_contentView.cursor()->setLayoutReference(pointedLayoutR);
|
||||
m_contentView.cursor()->setPosition(LayoutCursor::Position::Right);
|
||||
} else if (!layoutWillBeMerged ) { //&& !layoutR.isAllocationFailure()) {
|
||||
} else if (!layoutWillBeMerged && layoutR.parent().isDefined()) { //&& !layoutR.isAllocationFailure()) {
|
||||
m_contentView.cursor()->setLayoutReference(layoutR.layoutToPointWhenInserting());
|
||||
m_contentView.cursor()->setPosition(LayoutCursor::Position::Right);
|
||||
}
|
||||
} else if (!layoutWillBeMerged) {
|
||||
} else if (!layoutWillBeMerged && layoutR.parent().isDefined()) {
|
||||
m_contentView.cursor()->setLayoutReference(layoutR);
|
||||
m_contentView.cursor()->setPosition(LayoutCursor::Position::Right);
|
||||
}
|
||||
|
||||
@@ -107,11 +107,9 @@ void LayoutCursor::insertText(const char * text) {
|
||||
else {
|
||||
newChild = CharLayoutRef(text[i]);
|
||||
}
|
||||
m_layoutRef.addSibling(this, newChild);
|
||||
m_layoutRef = newChild;
|
||||
m_position = Position::Right;
|
||||
m_layoutRef.addSiblingAndMoveCursor(this, newChild);
|
||||
}
|
||||
if (pointedChild.isDefined()) {
|
||||
if (pointedChild.isDefined() && pointedChild.parent().isDefined()) {
|
||||
m_layoutRef = pointedChild;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user