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.
What has changed?
whenContexts.setCursorContextIfChanged
is called not upon onlychangeTextEditorSelection
andchangeActiveTextEditor
(as before), but alsochangeTextDocument
- to account for the case where a document change affected the meaning of the active point without moving it.Since most edits also move the active point, a check is added to avoid redundant calls to
setCursorContextIfChanged
. The check compares the event's editor, document version, and active point with those of the previous event.Tests: I have not figured out how to automate keypresses. The test would start with the document
|;•(foo)
where|
signifies the active point and•
is a newline; press Del (removing the semicolon), Del again (removing the newline), and Del again (passing harmlessly over the open-paren? or erroneously deleting it?).Alternative: There is also a changeTextDocument handler in mirror-doc. It might be a more robust place to adjust cursor context, although it would complicate coordination of edit- vs selection-occasioned adjustment. The thing is that the mirror-doc handler updates the model, which is used in
whenContexts.setCursorContextIfChanged
. Luckily, the problematic case involves TWO presses of Del and therefore in practice the present, un-tangled, change will address it.Fixes #2686
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.npm 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