[poincare] Fix LayoutNode::canBeOmittedMultiplicationRightFactor

This commit is contained in:
Léa Saviot
2018-11-21 11:04:10 +01:00
committed by Émilie Feral
parent 67f940dfd2
commit 39af89d661
4 changed files with 10 additions and 1 deletions

View File

@@ -28,6 +28,7 @@ public:
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
bool isChar() const override { return true; }
bool isCollapsable(int * numberOfOpenParenthesis, bool goingLeft) const override;
bool canBeOmittedMultiplicationRightFactor() const override;
// TreeNode
size_t size() const override { return sizeof(CharLayoutNode); }

View File

@@ -31,6 +31,7 @@ public:
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override;
bool mustHaveLeftSibling() const override { return true; }
bool isVerticalOffset() const override { return true; }
bool canBeOmittedMultiplicationRightFactor() const override { return false; }
// TreeNode
size_t size() const override { return sizeof(VerticalOffsetLayoutNode); }

View File

@@ -65,6 +65,13 @@ bool CharLayoutNode::isCollapsable(int * numberOfOpenParenthesis, bool goingLeft
return true;
}
bool CharLayoutNode::canBeOmittedMultiplicationRightFactor() const {
if (m_char == '!') {
return false;
}
return LayoutNode::canBeOmittedMultiplicationRightFactor();
}
// Sizing and positioning
KDSize CharLayoutNode::computeSize() {
return m_font->glyphSize();

View File

@@ -123,7 +123,7 @@ bool LayoutNode::canBeOmittedMultiplicationRightFactor() const {
* functions changes, it might not be the case anymore so make sure to modify
* canBeOmittedMultiplicationRightFactor if needed. */
int numberOfOpenParentheses = 0;
return isCollapsable(&numberOfOpenParentheses, false) && !isVerticalOffset();
return isCollapsable(&numberOfOpenParentheses, false);
}
// Private