Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Improve backspace and deleteForward functions for reader macro hash deletion
What has changed?
Enhanced backspace function in
src/cursor-doc/paredit.ts: Added comprehensive logic to handle deletion behavior when interacting with reader macro tokens (#(,#{), distinguishing between empty and non-empty forms, and properly managing cursor positioning.Enhanced deleteForward function in
src/cursor-doc/paredit.ts: Added detection for invalid reader prefixes (junk#tokens) and reader macro start positions, allowing proper deletion of#characters in appropriate contexts.Added comprehensive test suite: Implemented 12 new tests covering all hash character deletion scenarios for both backspace and delete-forward operations, ensuring robust behavior across different reader macro contexts.
The implementation correctly handles:
#(),#{}) - jumps over#instead of deleting#(prn "hello"),#{:foo :bar}) - allows#deletion#[...], junk#tokens) - allows#deletionFixes #2766
My Calva PR Checklist
I have:
devbranch. (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.npm run prettier-format)npm run eslintbefore creating your PR, or runnpm run eslint-watchto eslint as you go).