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

Update CodeMirror #12177

Merged
merged 2 commits into from
Apr 4, 2016
Merged

Update CodeMirror #12177

merged 2 commits into from
Apr 4, 2016

Conversation

marcelgerber
Copy link
Contributor

For #12031.

Several tests fail, but most of them do fail on master, too, so I suppose it's not my fault.
I, though, had to disable 3 EditorCommandHandlers tests which have to do with how CM handles atomic markers mid-text. There was a slight behavior change in codemirror/codemirror5@1fae537 which makes these tests fail.
This change could theoretically affect inline editors, but in my manual testing I didn't face any issues.
For more reference on this change, see codemirror/codemirror5#3699.

Fixes #11905, #11683, and a whole lot more.

@ficristo
Copy link
Collaborator

@marcelgerber++ 👍

@abose
Copy link
Contributor

abose commented Feb 1, 2016

@marcelgerber 👍

@abose
Copy link
Contributor

abose commented Feb 1, 2016

Tagging @swmitra

@MiguelCastillo
Copy link
Contributor

@marcelgerber I know these tests failed before your update. But do you think we can fix them in this PR to make sure we are not introducing regressions? It would awesome to have peace of mind.

@MiguelCastillo
Copy link
Contributor

It would be nice to explicitly call out which version of CodeMirror we are updating to. :)

@MiguelCastillo
Copy link
Contributor

@marcelgerber I found the particular change in CodeMirror that is causing this regression. I am going to dig in a little bit more to see if I can find the reason why the change was made. The question is whether or not that is the correct behavior in CodeMirror.

codemirror/codemirror5@1fae537?diff=unified

@MiguelCastillo
Copy link
Contributor

Well, this thread has the history of why the change of was made. codemirror/codemirror5#3658

@MiguelCastillo
Copy link
Contributor

@marcelgerber I found what we have to change on our side. The changes in codemirror actually seems to make things more consistent in behavior. I am still running tests.

https://github.com/adobe/brackets/blob/master/src/editor/Editor.js#L1507
That line would change to {line: to - 1, ch: 0}. We don't need to figure out the length anymore; CodeMirror will take the whole line.

@MiguelCastillo
Copy link
Contributor

@marcelgerber - BTW - if you want to see a visual of the behavior:

1 go to https://codemirror.net/index.html
2 open the browser console. We are going to execute the following commands

visibleRange1 = editor.markText({line: 0, ch: 0}, {line: 4, ch: 0}, {collapsed: true, inclusiveLeft: true, inclusiveRight: true, clearWhenEmpty: false});
visibleRange2 = editor.markText({line: 5, ch: 0}, {line: 8, ch: 0}, {collapsed: true, inclusiveLeft: true, inclusiveRight: true, clearWhenEmpty: false});

3 Select anything spanning multiple lines.

editor.setSelection({line: 0, ch: 0}, {line: 8, ch: 0});

4 Now clear both markers to see the selected text in the editor.

visibleRange1.clear();
visibleRange2.clear()

5 Checkout the selected range.

editor.doc.sel

That selects the whole line regardless of what's around, which is the behavior we want when we are hiding lines as the unit test does.

@MiguelCastillo
Copy link
Contributor

I found an odd behavior in CodeMirror that is causing our particular unit test failures. I have provided information over on the CodeMirror side.

@MiguelCastillo
Copy link
Contributor

@marcelgerber I think the issue is fixed in the latest code mirror. https://github.com/codemirror/CodeMirror/releases/tag/5.13.0. Gotta bring it down and test it.

@Denisov21
Copy link
Contributor

Now is exit a new version of Code Mirror https://github.com/codemirror/CodeMirror/releases/tag/5.13.2

@marcelgerber
Copy link
Contributor Author

Thanks for pointing that out!
I've updated to the latest version and now these tests, after being re-enabled pass again.

@MiguelCastillo
Copy link
Contributor

@marcelgerber CodeMirror had a couple of changes around ranges that fixed the issue :)

@MiguelCastillo
Copy link
Contributor

I pulled your branch. I am running today with it and if things go well, we can merge?

Marcel Gerber added 2 commits April 1, 2016 20:12
codemirror/codemirror5@c65244d changed
the behavior in this case; the newly inserted braces are no longer
part of the resulting selection.
@marcelgerber
Copy link
Contributor Author

Surely we can!
I've just now squashed the commit to get them down to only 2.

@MiguelCastillo
Copy link
Contributor

things seem to work ok. I will merge now so that more people can get to test this update early. Thank you @marcelgerber !!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants