Skip to content

Inconsistent line ending style created by Arduino IDE on Windows 7 #1552

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

Closed
prjemian opened this issue Aug 24, 2013 · 10 comments
Closed

Inconsistent line ending style created by Arduino IDE on Windows 7 #1552

prjemian opened this issue Aug 24, 2013 · 10 comments
Labels
Component: IDE The Arduino IDE Type: Bug Type: Duplicate Another item already exists for this topic
Milestone

Comments

@prjemian
Copy link

Using the Arduino IDE 1.0.5 to edit sketches, I find that the editor, when saving a sketch to disk, mixes the line-ending styles. This is observed on a Windows 7 machine, when editing code that is managed by subversion with the property::

svn propset eol:style native mysketch.ino

The problem is described when trying to commit changes back to subversion, the commit fails with a report of::

Commit failed (details follow):
While preparing
'C:\Users\Me\Documents\Arduino\mysketch\mysketch.ino'
for commit
Inconsistent line ending style

I regularly fix this situation by going to a tool that will make all the end-of-line characters consistent for my OS and then try committing again.

The Arduino IDE requires a fix since it is the generator of the inconsistent line endings. This is easy to demonstrate on a sketch that has several blank lines.

  1. Check that sketch out of subversion
  2. open the .ino file with the Arduino IDE
  3. delete one blank line
  4. save the file
  5. check back in to subversion

Step 5 here consistently produces this error for me when using Tortoise SVN as my subversion client.

Note that the same 5-step procedure on Linux Mint 15 and Arduino IDE 1.0.3 with the same project did not produce an error at step 5.

@matthijskooijman
Copy link
Collaborator

At first glance, it sounds to me like the editor simply always introduces LF characters as newlines, even in a file that already has CRLF. If that is the case, you could also drop the svn property and just use LF as newlines everywhere, instead of having SVN mangle your newlines on checkout/commit?

@prjemian
Copy link
Author

prjemian commented Jan 8, 2014

This only hides the situation. The fix is to use the EOL terminator appropriate for the host OS. Fix in a future version?

@ffissore ffissore added the New label Feb 27, 2014
@cmaglie cmaglie removed the New label Feb 27, 2014
@ffissore ffissore self-assigned this May 28, 2015
@ffissore
Copy link
Contributor

ffissore commented Jun 8, 2015

Sorry for the late reply. No, we are not going to fix it. Using a uniform line ending makes it easier to share the sketches

@ffissore ffissore closed this as completed Jun 8, 2015
@ffissore ffissore added the Type: Wontfix Arduino has decided that it will not resolve the reported issue or implement the requested feature label Jun 8, 2015
@ffissore ffissore added this to the Release 1.6.5 milestone Jun 8, 2015
@tico-tico
Copy link
Contributor

Sorry for touching a won't fix bug. Just to make sure you understand the problem, for now IDE's line endings are kinda consistent except for one last CRLF. Editing such files in other editors is PITA coz many of them like uniformity. Not-so-pretty picture for you:

ardedi

@prjemian
Copy link
Author

prjemian commented Aug 26, 2015 via email

@matthijskooijman matthijskooijman added Type: Bug and removed Type: Wontfix Arduino has decided that it will not resolve the reported issue or implement the requested feature labels Aug 27, 2015
@matthijskooijman
Copy link
Collaborator

Reopening this, as mixing LF and CRLF inside the same file would indeed be a bug to me (and I think me and @ffissore didn't realize this was the case before).

@tico-tico what OS are you running that on? Did you just open up the IDE and save the empty sketch somewhere? I just tried this on Linux, which just uses LF everywhere.

@tico-tico
Copy link
Contributor

what OS are you running that on?

Win 7 x64 SP1 Home Premium.

Did you just open up the IDE and save the empty sketch somewhere?

i guess i pressed Enter once)) here is screenshot of the unchanged empty sketch. Yes, I just saved it .

ardued2

The same result, actually.

I don't know if it matters, anyway, screenshot of the cpp file:

ardued3

@matthijskooijman
Copy link
Collaborator

Interesting that some #line directives also get inserted with CRLF apparently, but not others...

@tico-tico
Copy link
Contributor

Another piece of information. I just realize that there is NO new line at the end of the code if I use Arduino IDE, addition new line (CRLF) appears only in the SAVED file. I mean

number_of_lines_in_IDE == number_of_lines_in_file - 1

Some uses println() for saving 😄 A joke and a hint.))

@per1234
Copy link
Collaborator

per1234 commented Mar 19, 2018

Closing as duplicate of #6736, due to that one having received better attention.

This should be fixed in the beta build.

@per1234 per1234 closed this as completed Mar 19, 2018
@per1234 per1234 added the Type: Duplicate Another item already exists for this topic label Mar 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: IDE The Arduino IDE Type: Bug Type: Duplicate Another item already exists for this topic
Projects
None yet
Development

No branches or pull requests

6 participants