github / GitPad

Notepad.exe as Git commit editor
MIT License
187 stars 69 forks source link

Don't add new lines to the end of the file every time it's saved #16

Closed crdx closed 11 years ago

crdx commented 11 years ago

I've noticed over time my config files end up with more and more new lines at the end, and I suspected it was GitPad's doing but I didn't get a chance to investigate until now.

Program.cs:161

foreach (var line in fileData.Split('\n'))
{
    var fixedLine = line.Replace("\r", "");
    ret.Append(fixedLine);
    ret.Append(ending);
}

The resulting file contents have a trailing instance of whatever line ending character is being used, and this is then written to the file. So every time you use GitPad your config files end up with an extra new line. It was simple enough to fix.

anaisbetts commented 11 years ago

@crdx Only one review comment, then we can merge. Thanks for the PR!