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

Inconsistency for end of file newline #160

Closed
AJ-Acevedo opened this issue Feb 11, 2013 · 1 comment
Closed

Inconsistency for end of file newline #160

AJ-Acevedo opened this issue Feb 11, 2013 · 1 comment

Comments

@AJ-Acevedo
Copy link
Contributor

I was reading the source code and noticed some inconsistencies with how end of file was being handled. almost every file I opened has a blank line at the end of the file, but some files have two newlines and some have none.

I verified this with BBEdit 10.5, TextMate 2.0, and Sublime Text 2. Now when I open the same files via command line using vim, none of the end of file new lines were visible.

For example:
rails_apps_composer/sample.rb
Has two blank lines at the end of the file

These files have one blank line at the end of the file
rails_apps_composer/version.rb
rails_apps_composer/recipes/controllers.rb

This file does not have a blank line at the end of the file
rails_apps_composer/recipes/core.rb

@DanielKehoe Do you prefer to insert newlines at the end of the file or is this being caused by your text editor?

@MarkDBlackwell
Copy link
Contributor

BTW, @DanielKehoe's commit follows the standard practice (important for much Unix software) that newlines are line terminators, not line separators. Thus in each file the last line also is terminated by a newline.

By installation default, some editors (e.g. Sublime Text 2) omit that final newline from the file. (That is, unless the user correctly reconfigures the editor to include it.)

However, currently, Sublime Text 2 (even when correctly configured) shows a final blank line after that final newline. Maybe some other editors also do the same. This is incorrect. Obviously there is no extra line there. Unfortunately some editors still suggest to users that there is.

IMHO this happens from the editor developers' ignorance of this subtle point. Perhaps, at first thought, it's more intuitive for newlines to be line separators, rather than line terminators.

See also more support for Unix's practice in this Sublime Text 2 bug report.

tmock12 pushed a commit to tmock12/rails_apps_composer that referenced this issue Jun 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants