[pan2] Bug 596680: Make wrapping honor changes in compose-wrap pref.



commit d4911d341bf27b0afb83390e054bd56844dcf9e1
Author: Charles Kerr <charles rebelbase com>
Date:   Tue Sep 29 10:47:40 2009 -0500

    Bug 596680: Make wrapping honor changes in compose-wrap pref.

 pan/gui/post-ui.cc |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/pan/gui/post-ui.cc b/pan/gui/post-ui.cc
index 4fe1b05..f8f7ce6 100644
--- a/pan/gui/post-ui.cc
+++ b/pan/gui/post-ui.cc
@@ -127,7 +127,8 @@ PostUI :: get_body () const
   std::string body;
   GtkTextBuffer * buf (_body_buf);
   GtkTextView * view (GTK_TEXT_VIEW(_body_view));
-
+  const bool wrap (_prefs.get_flag ("compose-wrap-enabled", false));
+  
   // walk through all the complete lines...
   GtkTextIter body_start, body_end, line_start, line_end;
   gtk_text_buffer_get_bounds (buf, &body_start, &body_end);
@@ -136,7 +137,7 @@ PostUI :: get_body () const
     char * line = gtk_text_buffer_get_text (buf, &line_start, &line_end, false);
     body += line;
     g_free (line);
-    if (*body.rbegin() != '\n')
+    if (wrap && *body.rbegin() != '\n')
       body += '\n';
     line_start = line_end;
   }
@@ -163,9 +164,9 @@ PostUI :: set_wrap_mode (bool wrap)
 
   if (_body_buf) {
     const std::string s (get_body());
-    gtk_text_buffer_set_text (_body_buf, s.c_str(), s.size());
     gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW(_body_view),
                                  wrap ? GTK_WRAP_WORD : GTK_WRAP_NONE);
+    gtk_text_buffer_set_text (_body_buf, s.c_str(), s.size());
   }
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]