mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
[poincare] Fix CharLayout: avoid adding multiplication sign between Sto
and another expression
This commit is contained in:
committed by
EmilieNumworks
parent
386ebc5bfc
commit
d11967f41a
@@ -107,7 +107,7 @@ public:
|
||||
* inserted in the numerator (or denominator)? For instance, 1+2|3-4 should
|
||||
* become 1+ 2/3 - 4 when pressing "Divide": a CharLayout is collapsable if
|
||||
* its char is not +, -, or *. */
|
||||
bool canBeOmittedMultiplicationLeftFactor() const;
|
||||
virtual bool canBeOmittedMultiplicationLeftFactor() const;
|
||||
virtual bool canBeOmittedMultiplicationRightFactor() const;
|
||||
/* canBeOmittedMultiplicationLeftFactor and RightFactor return true if the
|
||||
* layout, next to another layout, might be the factor of a multiplication
|
||||
|
||||
@@ -51,6 +51,7 @@ bool CharLayout::isCollapsable(int * numberOfOpenParenthesis, bool goingLeft) co
|
||||
|| m_char == '*'
|
||||
|| m_char == Ion::Charset::MultiplicationSign
|
||||
|| m_char == Ion::Charset::MiddleDot
|
||||
|| m_char == Ion::Charset::Sto
|
||||
|| m_char == ','))
|
||||
{
|
||||
return false;
|
||||
@@ -58,6 +59,13 @@ bool CharLayout::isCollapsable(int * numberOfOpenParenthesis, bool goingLeft) co
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CharLayout::canBeOmittedMultiplicationLeftFactor() const {
|
||||
return m_char != Ion::Charset::Sto;
|
||||
}
|
||||
bool CharLayout::canBeOmittedMultiplicationRightFactor() const {
|
||||
return m_char != Ion::Charset::Sto;
|
||||
}
|
||||
|
||||
void CharLayout::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
|
||||
char string[2] = {m_char, 0};
|
||||
ctx->drawString(string, p, m_fontSize, expressionColor, backgroundColor);
|
||||
|
||||
@@ -28,6 +28,8 @@ public:
|
||||
|
||||
// Other
|
||||
bool isCollapsable(int * numberOfOpenParenthesis, bool goingLeft) const override;
|
||||
bool canBeOmittedMultiplicationLeftFactor() const override;
|
||||
bool canBeOmittedMultiplicationRightFactor() const override;
|
||||
protected:
|
||||
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
|
||||
KDPoint positionOfChild(ExpressionLayout * child) override {
|
||||
|
||||
Reference in New Issue
Block a user