From: Konstantin Sobolev <kos@supportwizard.com>
[apps/madmutt.git] / state.c
diff --git a/state.c b/state.c
index 715cc9e..7b44389 100644 (file)
--- a/state.c
+++ b/state.c
@@ -15,6 +15,9 @@
 
 #include "mutt.h"
 #include "state.h"
+#include "rfc3676.h"
+
+#include "lib/debug.h"
 
 static void state_prefix_put (const char *d, size_t dlen, STATE * s)
 {
@@ -74,6 +77,9 @@ void state_prefix_putc (char c, STATE * s)
       char buf[2 * SHORT_STRING];
       int j = 0, offset = 0;
       regmatch_t pmatch[1];
+#ifdef DEBUG
+      unsigned char save = '\0';
+#endif
 
       state_reset_prefix (s);
       while (regexec
@@ -85,7 +91,7 @@ void state_prefix_putc (char c, STATE * s)
         buf[0] = '\n';
         buf[1] = '\0';
       }
-      else if (option (OPTQUOTEQUOTED) && offset) {
+      else if (!option (OPTTEXTFLOWED) && option (OPTQUOTEQUOTED) && offset) {
         for (i = 0; i < offset; i++)
           if (Quotebuf[i] != ' ')
             j = i;
@@ -95,6 +101,15 @@ void state_prefix_putc (char c, STATE * s)
       else
         snprintf (buf, sizeof (buf), "%s%s", NONULL (s->prefix), Quotebuf);
 
+#ifdef DEBUG
+      if (str_len (buf) >= 2) {
+        save = buf[str_len (buf) - 1];
+        buf[str_len (buf) - 1] = '\0';
+        debug_print (2, ("buf = '%s'\n", buf));
+        buf[str_len (buf)] = save;
+      }
+#endif
+
       state_puts (buf, s);
     }
   }