Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing parens manually triggers malformed MathJSON #1742

Closed
sritchie opened this issue Dec 4, 2022 · 3 comments
Closed

Fixing parens manually triggers malformed MathJSON #1742

sritchie opened this issue Dec 4, 2022 · 3 comments

Comments

@sritchie
Copy link
Contributor

sritchie commented Dec 4, 2022

Description

(@jefffriesen found this while playing with mentat-collective/MathLive.cljs#11.)

to repro:

  • type an expression like 1+cos()y
  • decide you want to pull y into the parens
  • delete the right paren and retype it to the right of y

The Mathfield eagerly inserts a multiplication dot and parses the input as

image

Full interaction:

2022-12-04 08 48 41

MathJSON:

[
  "Sequence",
  [
    "Add",
    1,
    [
      "Sequence",
      [
        "Cos",
        [
          "Error",
          [
            "ErrorCode",
            "'expected-close-delimiter'",
            "\\right)"
          ],
          ["Latex", "'('"]
        ]
      ],
      [
        "Error",
        ["ErrorCode", "'expected-open-delimiter'", "\\left"],
        ["Latex", "'\\right.'"]
      ],
      "y"
    ]
  ],
  [
    "Error",
    ["ErrorCode", "'expected-open-delimiter'", "("],
    ["Latex", "')'"]
  ]
]
@arnog
Copy link
Owner

arnog commented Dec 5, 2022

I think that's a duplicate of #1656

@gerryfletch
Copy link

I'm noticing this quite frequently with parens, especially because if I type ( it'll create the corresponding ) for me, but pressing backspace to write into it creates the .

mgreminger added a commit to mgreminger/mathlive that referenced this issue Apr 17, 2023
Add regression tests for arnog#1691, arnog#1375, and arnog#1845

Add failing test for arnog#1656 and arnog#1742 and for issue where deleting and re-adding left delimiter doesn't trigger input event.
mgreminger added a commit to mgreminger/mathlive that referenced this issue Apr 17, 2023
Also fixes issue where, when left delimiter was deleted and replaced, a input event was not triggered.
arnog pushed a commit that referenced this issue Apr 18, 2023
Add regression tests for #1691, #1375, and #1845

Add failing test for #1656 and #1742 and for issue where deleting and re-adding left delimiter doesn't trigger input event.
arnog pushed a commit that referenced this issue Apr 18, 2023
Also fixes issue where, when left delimiter was deleted and replaced, a input event was not triggered.
@arnog
Copy link
Owner

arnog commented Apr 19, 2023

Fixed now.

@arnog arnog closed this as completed Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants