fixed edidition bulder to handle large inserts at end of doc.
properly handle (and format) linefeeds