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

undo history not working, when line-endings change after save #12865

Merged
merged 3 commits into from
Nov 1, 2016

Conversation

zaggino
Copy link
Contributor

@zaggino zaggino commented Nov 1, 2016

For a bug identified in #11826 (comment)

credits to @vahid-sanati for identifying this, put up a PR so we can have it merged asap

cc @petetnt @ficristo

@zaggino zaggino added this to the Release 1.8 milestone Nov 1, 2016
@zaggino zaggino force-pushed the zaggino/undo-history-lineendings branch from 357b0cf to d09eb4c Compare November 1, 2016 07:00
@ficristo
Copy link
Collaborator

ficristo commented Nov 1, 2016

The test added in #12681 probably should be updated or we should add a new one for this case.
It exists a Document.normalizeText which normalize line endings: maybe we should update to check also for \r and use it, but it doesn't check for null text, so maybe not.

Looking at the commits for 1.5 release-1.4...release-1.5
there are a couple of upgrade of CodeMirror. In that version of CodeMirror it was changed a bit the way new line endings where used and maybe that broke some assumptions of Brackets.

@petetnt
Copy link
Collaborator

petetnt commented Nov 1, 2016

Would it be worth it to extract and extend Document.normalizeText to FileUtils.js with other line ending related methods? Then we could just use FileUtils.normalizeLineEndings(text) which would return normalized text or null.

The solution for the problem LGTM, just 🚲 🏠

@zaggino
Copy link
Contributor Author

zaggino commented Nov 1, 2016

I wanted to use FileUtils.normalizeLineEndings but when I included it in the file it lead to circular dependencies and whole Brackets broke 😒 Really hate requirejs

@zaggino
Copy link
Contributor Author

zaggino commented Nov 1, 2016

Feel free to push/modify this branch if you want, I have very little time to give to this urgently.

@petetnt
Copy link
Collaborator

petetnt commented Nov 1, 2016

Really hate requirejs

Ditto. I say lets merge this now and bikeshed the normalization later.

@ficristo
Copy link
Collaborator

ficristo commented Nov 1, 2016

If you want to merge go ahead, but a test is really needed here. At least file a followup for it.

@zaggino
Copy link
Contributor Author

zaggino commented Nov 1, 2016

put up a test;

  • i believe that CM is returning always \n line-endings after the change @ficristo mentioned but i don't have time to investigate properly

@ficristo
Copy link
Collaborator

ficristo commented Nov 1, 2016

AFAIK if the lineSeparator option is not set CodeMirror return always \n line endings.

@petetnt
Copy link
Collaborator

petetnt commented Nov 1, 2016

Kinda worried about possible performance issues with larger files (possibly leading to External file changes-dialogs?) but otherwise LGTM.

@swmitra
Copy link
Collaborator

swmitra commented Nov 1, 2016

Merging.

@swmitra swmitra merged commit 3af64fa into release Nov 1, 2016
@swmitra
Copy link
Collaborator

swmitra commented Nov 1, 2016

Great work @vahid-sanati @zaggino @ficristo @petetnt

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.

4 participants