-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
For #2691, stabilize deleteForward by reducing asyncness #2692
base: dev
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for calva-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
…empty list - mirroring deleteBackward
…ed to reformatting
Thanks so much for contributing this work, @pbwolf! And thanks for researching throughly and detailing the rationale for the changes. It all makes sense, I think. The only thing I wonder about is why we call it Now and non-async, instead of just sync, as is the pattern in JS land. But we can change that later. It looks ready to merge, but the PRs are both marked Draft. Is there something you still want to change, @pbwolf? |
I restored the reformat-as-you-type in deleteForward for symmetry with deleteBackward: upon removing an empty list, it reformats. This can cause a strange cursor move, but I am not sure whether the answer is for deleteForward not to reformat or for reformatting not to move the cursor. There is a logic branch in the reformatting devoted specifically to moving the cursor if reformatting did not change the document. For example: |
~~Maybe I'm alone here? I think this should be viewed as a workaround, rather than a fix. We should hope at some point someone might be able to come back later and make things work both in-order and async. Please don't let that come across as any sort of disagreement with going through on the patch. A successful workaround is still successful.~~ Thanks for the work. Edit:
I might take that back? Seems I was talking without enough knowledge on the topic, so can't say for sure. In whatever, case thanks again for the hard work. |
This is a small addition to the backspace PR, doing the same for deleteForward.
What has changed?
The reason to skipFormat is: formatting moves the selection past commas, which in combination with deleteForward makes commas resist deletion! This interplay is newly exposed by the non-async deleteForward. The (prior) async deleteForward async'ly moved the selection, which "undid" formatting's selection if the timing worked out right.
Fixes #2691 and #2611
My Calva PR Checklist
I have:
dev
branch. (Or have specific reasons to target some other branch.)published
. (Sorry for the nagging.)[Unreleased]
entry inCHANGELOG.md
, linking the issue(s) that the PR is addressing.Added to or updated docs in this branch, if appropriatenpm run prettier-format
)npm run eslint
before creating your PR, or runnpm run eslint-watch
to eslint as you go).Ping @PEZ, @bpringe, @corasaurus-hex, @Cyrik