Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Atom adds new line on save. #3725

Closed
mikenovikov opened this issue Oct 5, 2014 · 12 comments
Closed

Atom adds new line on save. #3725

mikenovikov opened this issue Oct 5, 2014 · 12 comments

Comments

@mikenovikov
Copy link

Hi.
When saving a file, atom adds a new line character at the end of a file.
Is it issue or a feature?
Ubuntu 14.04. Atom 0.134.0.

@izuzak
Copy link
Contributor

izuzak commented Oct 5, 2014

Yeah, it's a feature -- you can disable that behavior in the settings for the Whitespace package. Open Atom Settings, and scroll down until you see the Whitespace package, and then uncheck "Ensure single trailing newline".

screen shot 2014-10-05 at 11 56 43 pm

@izuzak izuzak closed this as completed Oct 5, 2014
@PurHur
Copy link

PurHur commented Feb 7, 2016

Like how this "feature" looks like a bug.

@vmaha
Copy link

vmaha commented Feb 18, 2016

I think this should be considered a bug.

If a user opens an existing file that doesn't have a trailing newline, modifies some text in the middle of the file, and saves, I'd bet you the user won't expect (or want) a new line to be added to the end of the file.

@denysvitali
Copy link

Why should a file end with a newline?

@vmaha
Copy link

vmaha commented Mar 29, 2016

@izuzak can you reopen this issue for consideration given the above feedback?

@50Wliu
Copy link
Contributor

50Wliu commented Mar 29, 2016

@vmaha please see atom/whitespace#111 (comment), and for future reference whitespace-related issues should be reported to the whitespace package.

@vmaha
Copy link

vmaha commented Mar 29, 2016

@50Wliu thanks for the link. sad to hear that, but you guys are doing a great job otherwise, so i respect your decision.

@mnquintana
Copy link
Contributor

@vmaha @denysvitali If you're curious for the context behind why files should end with a newline, take a look at this Stack Overflow answer: http://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline/729795#729795

@vmaha
Copy link

vmaha commented Mar 29, 2016

@mnquintana We're not objecting to the general principle.

We're objecting to enforcing the principle on already existing files, without any indication to to the user.

IMO a better solution would be to enforce this rule for new files only. Or, if you want to enforce it for existing files, then indicate that you've cleaned the file, and provide an affordance for the user to [undo], and [disable rule] whenever this is done.

@denysvitali
Copy link

@mnquintana Seems a good reason, thanks!

@cyrilchapon
Copy link

cyrilchapon commented Apr 27, 2017

It's back now. But without whitespace package enabled

@lock
Copy link

lock bot commented Apr 2, 2018

This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

@lock lock bot locked and limited conversation to collaborators Apr 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants