]> git.notmuchmail.org Git - sup/commitdiff
bugfix: forward/reply without saving in the editor drops all newlines
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Wed, 23 Apr 2008 01:30:23 +0000 (18:30 -0700)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Wed, 23 Apr 2008 01:30:23 +0000 (18:30 -0700)
lib/sup/modes/edit-message-mode.rb

index f4d933387c84be3758fd64575f911a39fc7a1c7d..89476b32f194ccc941f15e095a05cab625cf03da 100644 (file)
@@ -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