Fix newlines.

Previously the newline handling modified the actual fragments, causing
multiple runs to always update the newlines.  Handle this appropriately.
Merge pull request #172 from apenney/fix-newlines

Fix newlines.