sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit e4602c0d124a91d4d78b74320d9420d4c0d577a8
parent ae97f653dfa70f002c6515bcd45d2fe57ba4656d
Author: William Morgan <wmorgan-sup@masanjin.net>
Date:   Tue, 22 Apr 2008 18:30:23 -0700

bugfix: forward/reply without saving in the editor drops all newlines

Diffstat:
M lib/sup/modes/edit-message-mode.rb | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git 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