adobe/brackets — pull request #7214 by njx (2014-03-17 14:58:01+00:00)
Title: Restore original selection behavior and fix up unit tests for recent CM change

Originally, CodeMirror's `setSelections()` defaulted to always using the last selection passed if no primary selection index was specified.
https://github.com/marijnh/CodeMirror/commit/00e4259be767733f0076f240db4ed13b2d4a2b0c 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.