Huw Davies : riched20: Use para and row ptrs in the EM_GETFIRSTVISIBLELINE handler.

Alexandre Julliard julliard at winehq.org
Mon Nov 2 16:21:19 CST 2020


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Mon Nov  2 08:23:16 2020 +0000

riched20: Use para and row ptrs in the EM_GETFIRSTVISIBLELINE handler.

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

---

 dlls/riched20/editor.c | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 38553f7add3..620cb4fedcb 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -4044,25 +4044,24 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
     return ((PARAFORMAT2 *)lParam)->dwMask;
   case EM_GETFIRSTVISIBLELINE:
   {
-    ME_DisplayItem *p = editor->pBuffer->pFirst;
+    ME_Paragraph *para = editor_first_para( editor );
+    ME_Row *row;
     int y = editor->vert_si.nPos;
-    int ypara = 0;
     int count = 0;
-    int ystart, yend;
-    while(p) {
-      p = ME_FindItemFwd(p, diStartRowOrParagraphOrEnd);
-      if (p->type == diTextEnd)
-        break;
-      if (p->type == diParagraph) {
-        ypara = p->member.para.pt.y;
-        continue;
-      }
-      ystart = ypara + p->member.row.pt.y;
-      yend = ystart + p->member.row.nHeight;
-      if (y < yend) {
-        break;
-      }
+
+    while (para_next( para ))
+    {
+      if (y < para->pt.y + para->nHeight) break;
+      count += para->nRows;
+      para = para_next( para );
+    }
+
+    row = para_first_row( para );
+    while (row)
+    {
+      if (y < para->pt.y + row->pt.y + row->nHeight) break;
       count++;
+      row = row_next( row );
     }
     return count;
   }




More information about the wine-cvs mailing list