Sublime Forum

Line endings not being detected properly on file open

#1

Hi, I’ve been having this problem on some files recently, I’m not entirely sure what’s failing here.

Some files open as Windows line endings (CRLF) and some files open as Unix line endings (LF) but all the files in my project appear to be Unix. I’m pretty sure about this because Git flags line ending changes and a while ago, I ran a script across my entire repo to convert to LF (I had a mix of line endings for some reason and it was annoying me, I wanted to standardise to LF).

Here’s a sequence of actions I can do to reproduce this:

  • Open a file in my repo
  • Status bar says “Windows”:
  • Click line ending button, change to LF
  • git flags no changes at all, the file was already LF
    Repeat on another file:
  • Status bar says “Windows”
  • Do nothing, leave as-is
  • Save the file
  • git flags entire file as changed since all line endings are now CRLF

In my user settings, I have set "default_line_ending" to “unix”. Nothing seems different about the files that open as “Unix” and work fine though; these files are the same filetype, same encoding, etc.

Thanks!

Platform info:
Build 3114
Windows 7 64

0 Likes

#2

Please (if you can) upload sample files that open as having Windows or UNIX style line endings so that we can verify whether the files are indeed using the line endings you say or think they are.

Using git is not always reliable since it has the autocrlf setting.

0 Likes