Extra newlines after CVS checkout

I am facing a problem which may or may not be Intellij related - can anyone help ?

There are some files I check out from CVS - probably files that were checked in on someone else's UNIX box - which I checkout using WinCVS or TortoiseCVS. Either way, these files open with normal line spacing in Textpad or Notepad, but when loaded in Intellij they have 2 newlines where there "should" be one.

Then, when I do a diff using Intellij, it reports all these extra newlines as "diffs" that I put in. A diff via WinCVS / TortoiseCVS correctly shows the file as unmodified.

Then if I delete the file manually and do a CVS update using the Intellij CVS menu, the file reloads with just the one newline.

I guess the problem here is the time-old UNIX newline (\n) verses Windows newline (\r\n) difference. Indeed, when I "less" the file using cygwin, I see the ^M characters on the end of each line that would be expected from a windows file read by a UNIX system. After doing the Intellij CVS update to get the file, the ^M chars had gone (e.g. the file was now a UNIX seperated file).

Why is Intellij loading and reading files in "UNIX-mode", but other CVS clients loading them in "Windows-Mode" and other editors reading files in "Windows-Mode" ? Is there a tickbox to change this behviour ? I have tried modifying many of the preferences and settings today, to no avail.

Many thanks in advance for any assistance,
Ben

1 comment
Comment actions Permalink

I know it's 7 years later, but I just had this same issue where the line separators are \r\n and notepad/everything other than IntelliJ show correctly, while IntelliJ shows an extra empty line between every actual line.  This also causes an issue with breakpoints.

I noticed that the reloading the file thing fixes it, but that's a pain to do for every file you touch.  If you go to File -> Invalidate Caches, this seems to fix the problem for all source files at once.

0

Please sign in to leave a comment.