[PATCH 2/6] riched20: Don't emit paragraph props if they're the same as the previous paragraph's.

Huw Davies huw at codeweavers.com
Tue Oct 11 07:04:00 CDT 2016


Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/riched20/writer.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/dlls/riched20/writer.c b/dlls/riched20/writer.c
index 0204215..27e07b1 100644
--- a/dlls/riched20/writer.c
+++ b/dlls/riched20/writer.c
@@ -429,6 +429,10 @@ ME_StreamOutRTFParaProps(ME_TextEditor *editor, ME_OutStream *pStream,
   PARAFORMAT2 *fmt = &para->member.para.fmt;
   char props[STREAMOUT_BUFFER_SIZE] = "";
   int i;
+  ME_Paragraph *prev_para = NULL;
+
+  if (para->member.para.prev_para->type == diParagraph)
+      prev_para = &para->member.para.prev_para->member.para;
 
   if (!editor->bEmulateVersion10) { /* v4.1 */
     if (para->member.para.nFlags & MEPF_ROWSTART) {
@@ -462,7 +466,9 @@ ME_StreamOutRTFParaProps(ME_TextEditor *editor, ME_OutStream *pStream,
     }
   }
 
-  /* TODO: Don't emit anything if the last PARAFORMAT2 is inherited */
+  if (prev_para && !memcmp( fmt, &prev_para->fmt, sizeof(*fmt) ))
+    return TRUE;
+
   if (!ME_StreamOutPrint(pStream, "\\pard"))
     return FALSE;
 
-- 
2.8.2




More information about the wine-patches mailing list