simpleclub / math_keyboard

Math expression editing using an on-screen software keyboard or physical keyboard input in a typeset input field in Flutter.
https://simpleclub.github.io/math_keyboard
BSD 3-Clause "New" or "Revised" License
133 stars 49 forks source link

Unnecessary parentheses added by `convertMathExpressionToTeXNode` #27

Open taojoe opened 2 years ago

taojoe commented 2 years ago

Bug description

when I need to set '{a}+{b}' to MathFieldEditingController, the convertMathExpressionToTeXNode add '()' to the expression, which it shouldn't.

To Reproduce

Steps to reproduce the behavior:

  1. run the following code with debug , then you will see the node has 5 leaves, the start and the end leaf are '(', ')'
    final node=convertMathExpressionToTeXNode(Parser().parse('{a}+{b}'));

Expected behavior

simple expression should not wrap with '()', '()' is only required when a lower priority expression as part of higher priority expression, like plus/minus expression as part of times expression

Screenshots

none

github-actions[bot] commented 2 years ago

Hi 👋🏽 Thank you for opening your first issue with simpleclub/math_keyboard ❤

You can expect triage from us soon 🙂 In the meantime, you can try to search for similar issues in our issue database.

creativecreatorormaybenot commented 2 years ago

Hi @taojoe, thanks for reporting. This is indeed something that we also noticed. This would require to enhance the way we update the math controller.