Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Restore original selection behavior and fix up unit tests for recent CM change #7214

Merged
merged 1 commit into from
Mar 17, 2014

Conversation

njx
Copy link
Contributor

@njx njx commented Mar 17, 2014

Originally, CodeMirror's setSelections() defaulted to always using the last selection passed if no primary selection index was specified.
codemirror/codemirror5@00e4259 changed it so the default is to use the index of the primary selection from whatever the previous selection was.

I commented on that commit that I'm not sure that was the right change, but I think it's arguable. In any case, this commit fixes things to restore our previous behavior:

  • We always set primIndex to the last item in the selection if no primary selection is specified.
  • Some of the selection-related unit tests were testing things by directly setting the selection in CodeMirror and then reading it back via our APIs. The unit tests that were relying on the old default behavior now explicitly pass the index of the last selection.

@njx
Copy link
Contributor Author

njx commented Mar 17, 2014

@redmunds - should merge this soon to fix the unit tests - sorry I didn't run them before I pushed the new SHA...

@redmunds
Copy link
Contributor

Reviewing

@redmunds
Copy link
Contributor

Merging.

redmunds added a commit that referenced this pull request Mar 17, 2014
Restore original selection behavior and fix up unit tests for recent CM change
@redmunds redmunds merged commit da1f4a5 into master Mar 17, 2014
@redmunds redmunds deleted the nj/fix-unit-tests branch March 17, 2014 15:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants