Huw Davies : riched20: Maintain a ptr to the end-of-paragraph run.

Alexandre Julliard julliard at winehq.org
Fri Oct 7 14:46:47 CDT 2016


Module: wine
Branch: master
Commit: d132009ae99426bcab8adea89d17ff46e60f9401
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d132009ae99426bcab8adea89d17ff46e60f9401

Author: Huw Davies <huw at codeweavers.com>
Date:   Fri Oct  7 10:49:34 2016 +0100

riched20: Maintain a ptr to the end-of-paragraph run.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/riched20/editstr.h | 1 +
 dlls/riched20/para.c    | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/dlls/riched20/editstr.h b/dlls/riched20/editstr.h
index 0e60a3d..fb88f71 100644
--- a/dlls/riched20/editstr.h
+++ b/dlls/riched20/editstr.h
@@ -201,6 +201,7 @@ typedef struct tagME_Paragraph
   POINT pt;
   int nHeight, nWidth;
   int nRows;
+  ME_Run *eop_run; /* ptr to the end-of-para run */
   struct tagME_DisplayItem *prev_para, *next_para;
 } ME_Paragraph;
 
diff --git a/dlls/riched20/para.c b/dlls/riched20/para.c
index e246e37..0174252 100644
--- a/dlls/riched20/para.c
+++ b/dlls/riched20/para.c
@@ -81,6 +81,8 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
   run->member.run.len = eol_len;
   run->member.run.para = &para->member.para;
 
+  para->member.para.eop_run = &run->member.run;
+
   ME_InsertBefore(text->pLast, para);
   ME_InsertBefore(text->pLast, run);
   para->member.para.prev_para = text->pFirst;
@@ -272,6 +274,10 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run,
   ME_InsertBefore(run, new_para);
   ME_InsertBefore(new_para, end_run);
 
+  /* Fix up the paras' eop_run ptrs */
+  new_para->member.para.eop_run = run_para->member.para.eop_run;
+  run_para->member.para.eop_run = &end_run->member.run;
+
   if (!editor->bEmulateVersion10) { /* v4.1 */
     if (paraFlags & (MEPF_ROWSTART|MEPF_CELL))
     {
@@ -429,6 +435,9 @@ ME_DisplayItem *ME_JoinParagraphs(ME_TextEditor *editor, ME_DisplayItem *tp,
     pTmp->member.run.para = &tp->member.para;
   } while(1);
 
+  /* Fix up the para's eop_run ptr */
+  tp->member.para.eop_run = pNext->member.para.eop_run;
+
   ME_Remove(pRun);
   ME_DestroyDisplayItem(pRun);
 




More information about the wine-cvs mailing list