Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text Editor Removes Linefeeds #4464

Closed
twoodhouse opened this issue Apr 25, 2018 · 6 comments · Fixed by #5622
Closed

Text Editor Removes Linefeeds #4464

twoodhouse opened this issue Apr 25, 2018 · 6 comments · Fixed by #5622

Comments

@twoodhouse
Copy link

@twoodhouse twoodhouse commented Apr 25, 2018

I am running Jupyter lab 0.31.4 on Windows 7.

Today I realized that the jupyter lab text editor (not the notebook editor) is removing line feeds from all of my files. The files still display correctly in jupyter lab and vim, but when I open them in notepad, they are all displayed in one line.

I verified this by writing/saving a new text file in notepad, opening it in Jupyter lab, changing one character, then saving.
When I open it in notepad again, it has been compressed into one line.

I will not have time to really follow up on this issue. Just wanted to let the project know since it is not apparent from within the editor.

@vidartf
Copy link
Member

@vidartf vidartf commented Apr 26, 2018

This is probably due to lab/notebook normalizing the line endings. Notepad famously does not understand non-Windows line endings (Wordpad does). Whether lab should be doing this is an open debate I think.

@jasongrout
Copy link
Contributor

@jasongrout jasongrout commented Apr 26, 2018

I wonder if this is a problem with the notebook server, which is the thing that actually writes the files to disk. What happens if you open, edit, and save these files in the classic notebook?

@afonit
Copy link

@afonit afonit commented Apr 27, 2018

I just tried this in classic.
The behavior is as mentioned in the original post.

As @vidartf said the files look fine in wordpad, it is just notepad where they are put in a single line.

@ian-r-rose
Copy link
Member

@ian-r-rose ian-r-rose commented Apr 27, 2018

Yes, the DocumentRegistry package normalizes line endings to \n. We were having problems with model-view synchronization in CodeMirror when documents had \r\n line endings, which prompted the change.

Now that I look at that code path, I wonder if it also might be responsible for the spurious "dirty" state that some people were seeing (I can't find the issue right now)?

@jasongrout
Copy link
Contributor

@jasongrout jasongrout commented Apr 27, 2018

Yes, the DocumentRegistry package normalizes line endings to \n.

Oh, interesting. Yes, we should definitely be smarter about maintaining the CRLF status of the file.

@ian-r-rose
Copy link
Member

@ian-r-rose ian-r-rose commented Apr 27, 2018

I don't think anyone was particularly happy about this solution, but it was the lesser of two evils at the time (the alternative was inserting text to the wrong location in the buffer).

@blink1073 blink1073 added this to the Future milestone Sep 10, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

6 participants