Skip to content

[CLOSED] Restore original selection behavior and fix up unit tests for recent CM change #6520

@core-ai-bot

Description

@core-ai-bot

Issue by njx
Monday Mar 17, 2014 at 14:58 GMT
Originally opened as adobe/brackets#7214


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 included the following code: https://github.com/adobe/brackets/pull/7214/commits

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions