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

Inserting nothing in Pyret gives a parse error #3

Open
2 tasks
schanzer opened this issue Sep 24, 2019 · 0 comments
Open
2 tasks

Inserting nothing in Pyret gives a parse error #3

schanzer opened this issue Sep 24, 2019 · 0 comments

Comments

@schanzer
Copy link
Member

[From https://github.com/bootstrapworld/codemirror-blocks/issues/248]
Start with the code

f(x)

Now double-click on the drop target to one side of the x, and insert "" or " ".

This should be a no-op: you haven't inserted anything. Instead, it's a parse error. What happens is:

  1. A copy of the node f(x) is made.
  2. A new child is inserted into this node. This child is a fake node that prints itself out as " ", since that's what you inserted.
  3. The copied node is pretty-printed, producing f(x, ).
  4. The edit is thus taken to be: f(x) => f(x, ).
  5. Hence, parse error.

To fix this, I think we should add a check to see if text is purely whitespace in src/edits/performEdits/edit_insert(). If it is, skip the insert because nothing is being inserted.

TODO:

  • Fix this.
  • Think: will a similar problem plague any other kind of edit? If so, fix that too.
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

1 participant