From: William Morgan Date: Wed, 23 Apr 2008 01:30:23 +0000 (-0700) Subject: bugfix: forward/reply without saving in the editor drops all newlines X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=e4602c0d124a91d4d78b74320d9420d4c0d577a8;p=sup bugfix: forward/reply without saving in the editor drops all newlines --- diff --git a/lib/sup/modes/edit-message-mode.rb b/lib/sup/modes/edit-message-mode.rb index f4d9333..89476b3 100644 --- a/lib/sup/modes/edit-message-mode.rb +++ b/lib/sup/modes/edit-message-mode.rb @@ -122,7 +122,7 @@ EOS @file = Tempfile.new "sup.#{self.class.name.gsub(/.*::/, '').camel_to_hyphy}" @file.puts format_headers(@header - NON_EDITABLE_HEADERS).first @file.puts - @file.puts @body + @file.puts @body.join("\n") @file.close editor = $config[:editor] || ENV['EDITOR'] || "/usr/bin/vi" @@ -213,7 +213,7 @@ protected def parse_file fn File.open(fn) do |f| header = MBox::read_header f - body = f.readlines + body = f.readlines.map { |l| l.chomp } header.delete_if { |k, v| NON_EDITABLE_HEADERS.member? k } header.each { |k, v| header[k] = parse_header k, v } @@ -304,7 +304,7 @@ protected def build_message date m = RMail::Message.new m.header["Content-Type"] = "text/plain; charset=#{$encoding}" - m.body = @body.join + m.body = @body.join("\n") m.body = m.body m.body += sig_lines.join("\n") unless $config[:edit_signature] @@ -364,7 +364,7 @@ EOS end f.puts - f.puts sanitize_body(@body.join) + f.puts sanitize_body(@body.join("\n")) f.puts sig_lines if full unless $config[:edit_signature] end @@ -409,7 +409,7 @@ private end def top_posting? - @body.join =~ /(\S+)\s*Excerpts from.*\n(>.*\n)+\s*\Z/ + @body.join("\n") =~ /(\S+)\s*Excerpts from.*\n(>.*\n)+\s*\Z/ end def sig_lines