brackets-archive / bracketsIssues

Archive of issues in brackets.
0 stars 0 forks source link

adding lineEndings UI in statusbar for documents #13017

Open core-ai-bot opened 3 years ago

core-ai-bot commented 3 years ago

Issue by sriram-dev Sunday Jan 11, 2015 at 09:42 GMT Originally opened as https://github.com/adobe/brackets/pull/10346


Fix for #10106 and #10594 Tests Done 1) All tests under Brackets->Run Tests 2) jshint tests run from grunt jshint 3) Open a file, modify the Line ending option from existing(say CRLF) to other(say LF), save file. Close the file and reopen to notice that modified LineEnding is preserved. Let me know if any unit tests needs to be added for the change. I couldn't find any added for other status bar options available.


sriram-dev included the following code: https://github.com/adobe/brackets/pull/10346/commits

core-ai-bot commented 3 years ago

Comment by sriram-dev Sunday Jan 11, 2015 at 12:14 GMT


Looks like travis failed because of CLA agreement. I had once signed long time back. Not sure if it was changed. I have re signed it now. Please restart if possible.

core-ai-bot commented 3 years ago

Comment by sprintr Friday Jan 16, 2015 at 18:46 GMT


@sriram-dev After changing line endings, it loses the cursor position. It would be nice if it retain cursor position.

core-ai-bot commented 3 years ago

Comment by sriram-dev Saturday Jan 17, 2015 at 15:15 GMT


Yes. I will make one more commit to the PR to preserve cursor position and scroll position while modifying lineEndings.

core-ai-bot commented 3 years ago

Comment by peterflynn Saturday Jan 17, 2015 at 18:21 GMT


One last thought: should toggling line endings mark the document as dirty? It could be confusing if a user toggles line endings, then closes the document, then discovers later that it still has the old line-ending type. OTOH, it could be architecturally a little tricky (or messy) to have this affect the dirty flag.

core-ai-bot commented 3 years ago

Comment by MarcelGerber Saturday Jan 17, 2015 at 23:38 GMT


If it marks the doc dirty, it should also be possible to undo using Ctrl-Z.

core-ai-bot commented 3 years ago

Comment by peterflynn Sunday Jan 18, 2015 at 04:32 GMT


Making it undoable as@MarcelGerber suggested is likely to be pretty tricky -- e.g. pushing some kind of custom entry onto the CodeMirror history stack. I don't feel we need to go that far, though.

One simple way we could mark it dirty: when changing line endings, set isDirty to true and also set a _lineEndingsDirty flag; then in _handleEditorChange(), change the expression to !editor._codeMirror.isClean() || this._lineEndingsDirty (and clear both flags in _markClean()).

core-ai-bot commented 3 years ago

Comment by sriram-dev Sunday Jan 18, 2015 at 05:16 GMT


_handleEditorChange does not get triggered when lineEndings are changed currently. But just setting document.isDirty flag to true in setLineEndings and save(prompted otherwise on closing) afterwards preserve lineEndings.

core-ai-bot commented 3 years ago

Comment by peterflynn Monday Jan 19, 2015 at 04:58 GMT


@sriram-dev The _handleEditorChange() part is important: if you change line endings, type something, then undo, the editor will be marked clean again and you'll be unable to save the lineEndings change. (And then once you have the _handleEditorChange() part, the _markClean() part is important too, to turn off that behavior once the file is actually clean again).

core-ai-bot commented 3 years ago

Comment by sriram-dev Monday Jan 19, 2015 at 13:45 GMT


@peterflynn Got the reasoning now. Thanks for the clarification.

core-ai-bot commented 3 years ago

Comment by MarcelGerber Wednesday Jan 21, 2015 at 16:01 GMT


The reason I suggested Ctrl-Z should also work for undoing this change is that I, and I'm certainly not the only one, often times get documents back into a clean state by pressing Ctrl-Z until it's clean again. So I kind of expect that you can always get the document into a clean state by undoing several times. If somebody relies on this, it could easily lead to confusion if this doesn't work with this (but only this) feature.

core-ai-bot commented 3 years ago

Comment by sriram-dev Thursday Jan 29, 2015 at 03:40 GMT


I see currently none of the options in the status bar is affected by ctrl+z(ins/ovr, tab/spaces etc). Anyways can someone please confirm if we need it affected by ctrl+z or if the changes are fine for the PR ?

core-ai-bot commented 3 years ago

Comment by MarcelGerber Saturday Jan 31, 2015 at 21:50 GMT


The difference is, options like INS/OVR and tab/spaces don't directly change the document. They change how you interact with them, but they don't touch the content itself, while CRLF/LF does. I also checked Notepad++ and yeah, you can undo CRLF/LF changes there.

core-ai-bot commented 3 years ago

Comment by sriram-dev Monday Feb 02, 2015 at 14:10 GMT


@MarcelGerber Sounds like the right thing to do :)

core-ai-bot commented 3 years ago

Comment by sriram-dev Monday Mar 09, 2015 at 14:17 GMT


@peterflynn @MarcelGerber If we want the line endings to be part of Ctrl+z, can you guys provide some pointers on the code changes needed for that ?

core-ai-bot commented 3 years ago

Comment by sriram-dev Tuesday May 12, 2015 at 07:19 GMT


Can someone please update on the next steps for this ?

core-ai-bot commented 3 years ago

Comment by rhbecker Wednesday May 20, 2015 at 19:30 GMT


I apologize if this is the wrong place to ask, but is there any chance this will be included in the next release?

core-ai-bot commented 3 years ago

Comment by abose Sunday Jul 12, 2015 at 16:39 GMT


@sriram-dev@rhbecker We apologize for the delay in response, i have tried to schedule this PR to release 1.4. It looks like we might not have enough bandwidth available to ship this pr through this release. @rhbecker@sriram-dev Could you give a quick summary of the current state of the pr and the risks if this where to be shipped in 1.4? @MarcelGerber Could you help with this pr? Would this be safe to be picked up for 1.4? Again, sorry for having to keep this pr waiting.

core-ai-bot commented 3 years ago

Comment by MarcelGerber Thursday Jul 16, 2015 at 13:34 GMT


Related: http://discuss.codemirror.net/t/custom-entries-in-undo-history/304 Let's see how far we get.

core-ai-bot commented 3 years ago

Comment by MarcelGerber Tuesday Jul 21, 2015 at 13:12 GMT


This didn't quite work out well, but after a CM update, we could make use of the newly added option lineSeparator

core-ai-bot commented 3 years ago

Comment by ficristo Tuesday Aug 02, 2016 at 17:34 GMT


@sriram-dev@MarcelGerber what is the status of this?

core-ai-bot commented 3 years ago

Comment by ficristo Saturday Sep 17, 2016 at 08:02 GMT


Given this discussion the lineSeparator option is not really helpful and we will have to write our own mechanism for the undo.