commit 08b79777eef4b460d3696d997c3daeb0fd9e5709
parent 44cc6d073d34bca502e4d60d49bf67dc7f3e78f7
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date: Fri, 2 Nov 2007 17:27:22 +0000
better fix for reply-mode and edit-message-mode header tweaking
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@662 5c8cc53c-5e98-4d25-b20a-d8db53a31250
Diffstat:
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/lib/sup/modes/edit-message-mode.rb b/lib/sup/modes/edit-message-mode.rb
@@ -286,13 +286,17 @@ EOS
f.puts sig_lines if full unless $config[:edit_signature]
end
-private
+protected
def edit_field field
case field
when "Subject"
text = BufferManager.ask :subject, "Subject: ", @header[field]
- @header[field] = parse_header field, text if text
+ if text
+ @header[field] = parse_header field, text
+ update
+ field
+ end
else
default =
case field
@@ -306,12 +310,14 @@ private
if contacts
text = contacts.map { |s| s.longname }.join(", ")
@header[field] = parse_header field, text
+ update
+ field
end
end
-
- update
end
+private
+
def sanitize_body body
body.gsub(/^From /, ">From ")
end
diff --git a/lib/sup/modes/reply-mode.rb b/lib/sup/modes/reply-mode.rb
@@ -121,11 +121,12 @@ protected
(@m.refs + [@m.id]).map { |x| "<#{x}>" }.join(" ")
end
- def edit_message_or_field
- @selected_type = :user
- self.header = @headers[:user]
- update
- super
+ def edit_field field
+ edited_field = super
+ if edited_field && edited_field != "Subject"
+ @selected_type = :user
+ update
+ end
end
def move_cursor_left