I am using Windows 7 (at work) and have just noticed a conflict between files edited on my Windows machine.
I don't recall this happening before I did this recent update to the IDE.
What I would like ( and what I thought the behavior was ) is for the newline characters to be left as they are and for new instances of newline to follow the rest of the file.
What I have found is a single edit such as adding a space to the file and saving the file causes the IDE to rewrite the file and place CRLF on all line endings.
Is there a workaround? Is this a bug in the IDE introduced recently?
Good work finding the relevant issue report! There was a bug where the IDE would produce inconsistent line endings. The chosen solution was to make them consistent, but fixed according to your OS. Even though I use Windows, I also prefer to use Unix style line endings in all my files. I think the solution proposed by matthijskooijman would be ideal. I think the Arduino developers would be receptive to a patch contributed from the community for this change. Otherwise we can wait and hope they get to it eventually. Unfortunately, I don't think it will be a high priority for them since the current behavior is an improvement over the previous behavior and can't be considered a bug. For now, I just have my Git settings so that all files are committed to my repositories with Unix style line endings. So, even though the sketches on my computer aren't formatted as I prefer, at least I don't subject the rest of the world to Windows style line endings.
You got it. I set core.autocrlf to input in all my own repositories. That means it checks out line endings as-is, but commits Unix style line endings.
My global setting is core.autocrlf false because if I’m contributing to someone else’s repository and the file I’m editing has something other than Unix EOL then I don’t want to change the line endings of the file as an unintended side effect of my unrelated edit. If I did want to change their line endings I would do that in a dedicated commit to keep the changes atomic and the diff easily readable.